Hi
Considering that , “puts” always return “nil” why in below code the
highlighted part of code just print the contents of
“first,second,third,forth” variable ? for example content of “first”
variable is “nil” and when we type “puts first” ruby must execute 2
times “nil” .
def test1 number
puts “test1”*number
end
def test2 number
“test2”*number
end
def test3 number
“test3”*number
puts “test3”*number
end
def test4 number
puts “test4”*number
“test4”*number
end
Considering that , “puts” always return “nil” why in below code the
highlighted part of code just print the contents of
“first,second,third,forth” variable ? for example content of “first”
variable is “nil” and when we type “puts first” ruby must execute 2
times “nil” .
What output do you expect to see?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.