📜  Tcl 获取列表的一部分 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:44.647000             🧑  作者: Mango

代码示例1
% Make Arbitrary List
set ListA {10 20 30 40 50 60};
puts $ListA;

% Select Range of values based on index positions: (N.B. First element of list has index 0)
set start_index 2;         % Select Start Index (2 Corresponds to 3rd item in list)
set end_index 5;         % Select End Index     (5 Corresponds to 6th ithem in list)

% SPlit List
set ListA_Part [lrange $ListA $start_index $end_index];
puts $ListA_Part