test for equality: : if as modifier « Statement « Ruby






test for equality:


age = 24
puts "You're 24!" if age == 24

 








Related examples in the same category

1.using if as a modifier with Boolean operator
2.Output based on if statement
3.If the value of age is under 18, the string is printed to the screen.
4.change the order: placing if after puts, and you can drop then and end.