Answer the question
In order to leave comments, you need to log in
What does then mean in Ruby?
Switched to ruby. I see the following construction:
if 'there is some condition' then
puts 'bla bla bla'
end
then - it is not necessary to write and it refers to the if, or is it used somewhere else, do I think it right?
Answer the question
In order to leave comments, you need to log in
then is needed if you want to use if in one line
val = 5
puts (if val == 1 then '1' else 'Not 1' end)
then - not required to be written and refers to ifu,
www.tutorialspoint.com/ruby/ruby_if_else.htm what's in square brackets is optional
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question