using if as a modifier with Boolean operator : if as modifier « Statement « Ruby






using if as a modifier with Boolean operator


temperature = 76
puts "Picnic time!" if temperature > 65 && temperature < 85

 








Related examples in the same category

1.Output based on if statement
2.test for equality:
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.