S
SpringFlowers AutumnMoon
i thought if it is
a = b = c
due to associativity rule, then it is
a = (b = c)
so (b = c) is evaluated first. and then now it will be a =
(evaluated_value)
now how come when
a = Array(1..100)
and to cut off the first 1/3 and last 1/3 of the array to get about 33
elements, shouldn't we use
a[0..a.size/2] = a[a.size*2/3..-1] = nil
as after the last 1/3 is deleted, you got about 66 elements remaining
and we want the other half deleted, to get to 33 elements. However, it
won't work and requires
a[0..a.size/3] = a[a.size*2/3..-1] = nil
why is that?
a = b = c
due to associativity rule, then it is
a = (b = c)
so (b = c) is evaluated first. and then now it will be a =
(evaluated_value)
now how come when
a = Array(1..100)
and to cut off the first 1/3 and last 1/3 of the array to get about 33
elements, shouldn't we use
a[0..a.size/2] = a[a.size*2/3..-1] = nil
as after the last 1/3 is deleted, you got about 66 elements remaining
and we want the other half deleted, to get to 33 elements. However, it
won't work and requires
a[0..a.size/3] = a[a.size*2/3..-1] = nil
why is that?