+ 15
[ Solved ] Why code output is 33?
Practicing what I learned with Ruby challenges. Have no idea why the code output is - 33? Below is the screenshot of challenge: https://www.sololearn.com/post/593067/?ref=app
2 Antworten
+ 6
a = 0
for i in (10..12)
a+=i
end
=begin
10.times do
at+=1
=end
puts a
for i in (10..12)
this for loop gives 10, 11, 12
a+=i
this line adds (a=10+11+12) and hence equals to 33.
anything between
=begin
.
.
.
=end
are comments.
+ 6
Thanks RKK !
I understood it later while learning from tutorial the difference between ".." 2 dots and 3 dots "..." with the given value 😅