+ 1

for i in (1..10) puts i x=0 x+=i puts x end #can anyone explain the output here

need help

11th Sep 2017, 1:45 PM
Abeer Mahmood
Abeer Mahmood - avatar
6 Respostas
+ 3
You are doing two times for i in (1..10) puts i end #can anyone explain the output here It is enough so
11th Sep 2017, 1:47 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 1
ow thnx
11th Sep 2017, 1:48 PM
Abeer Mahmood
Abeer Mahmood - avatar
+ 1
It outputs 1 1 2 2 3 3 ... 9 9 10 10
11th Sep 2017, 1:49 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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
11th Sep 2017, 1:51 PM
Daniel
Daniel - avatar
+ 1
thnx
11th Sep 2017, 1:51 PM
Abeer Mahmood
Abeer Mahmood - avatar
0
yup
11th Sep 2017, 1:49 PM
Abeer Mahmood
Abeer Mahmood - avatar