if-else statement
if something
do something
elsif somethingelse
do somethingelse
else
do otherwise
unlike Java or c++, Ruby uses elsif.
unless: shorthand for if
something_is_wrong = false
dosomething unless something_is_wrong
will execute dosomething. basically the same as if, just different in the sense that it is attached to the end of a statement.
if something
do something
elsif somethingelse
do somethingelse
else
do otherwise
unlike Java or c++, Ruby uses elsif.
unless: shorthand for if
something_is_wrong = false
dosomething unless something_is_wrong
will execute dosomething. basically the same as if, just different in the sense that it is attached to the end of a statement.