+ 1
for i in (1..10) puts i x=0 x+=i puts x end #can anyone explain the output here
need help
6 Réponses
+ 3
You are doing two times
for i in (1..10)
puts i
end #can anyone explain the output here
It is enough so
+ 1
ow thnx
+ 1
It outputs
1
1
2
2
3
3
...
9
9
10
10
+ 1
1
1
2
2
.....
First put print i value into range per each iteration
Second put always will be same than first because always begin with 0 so 0+i is i
+ 1
thnx
0
yup