+ 1
What is the output of this code?
def x(y) res = 0 (0..y).each {|z| res+=z} res end puts x(3)
5 Answers
+ 7
You can check the output by yourself. Run this code in code playground.
- Tap on { } icon at top bar
- Tap on + floating button
- Select ruby
- Paste your code and hit run 🏃
+ 1
6
- 1
What is the output of this code?
def x(y)
res = 0
(0..y).each {|z| res+=z}
res
end
puts x(3)
- 1
What is the output of this code?
def x(y)
res = 0
(0..y).each {|z| res+=z}
res
end
puts x(3)
- 1
😔😔😔



