Code:
Hello all:
I confuse with the array size.
I got two codes for array size as follow;
codeOne
array set myarray {1 2 3 4}
puts "all the elements in the array are : [array get myarray]"
puts "the array size is : [array size myarray]"
it suppose output 4, but the result is 2, why.
/////////////////////////////////////////
codeTwo
set x(1) one
puts "The first one is :[array get x]"
set x(2.0) two
puts "The second one is :[array get x] "
set x(three) 3
puts "The third two is : [array get x]"
set x("four") [list 1 2 3 4]
puts "The fourth one is : [array get x ]"
puts "the array size is : [array size x]"
IN here, it should output 8 for the arraysize, but it output 4. beacuse in the array has 8 elements, they are {"four"} {1 2 3 4} three 3 2.0 two 1 one
why ??????
////////////////////////////////////////////////////
And I also confuse with the array size's difinition, whta does the folowing sentence means???
array size arrayName
Returns a decimal string giving the number of elements in the array
rgds
stewang