if conditions ruby code example
Example 1: ruby unless
unless number.even?
# runs if `number` is NOT even
else
# runs if `number` is even
end
Example 2: if else ruby
if condition
expression
else
expression
unless number.even?
# runs if `number` is NOT even
else
# runs if `number` is even
end
if condition
expression
else
expression