Answers for "ruby if else"

6

ruby unless

unless number.even?
  # runs if `number` is NOT even
else
  # runs if `number` is even
end
Posted by: Guest on May-05-2020
4

ruby else if

x = 1
if x > 2
   puts "x is greater than 2"
elsif x <= 2 and x!=0
   puts "x is 1"
else
   puts "I can't guess the number"
end
Posted by: Guest on May-05-2020
1

ruby if statement

if condition
	expression
Posted by: Guest on January-01-2020
-1

if else ruby

if condition
  expression
else
  expression
Posted by: Guest on October-06-2020
-1

ruby if else

if true
  "if statement"
elsif false
  "else if, optional"
else
  "else, also optional"
end
Posted by: Guest on January-07-2021

Browse Popular Code Answers by Language