LoginSignup
0
0

More than 3 years have passed since last update.

Ruby学習#17 If Statements

Posted at

I wave up
If I'm hungry
I eat breakfast

I leave my house
if it's cloudy
I bring an umbrella
otherwise
I bring sunglasses

Im at a restaurant
if I want meat
I order a steak
otherwise if I want pasta
I order spaghetti & meatballs
otherwise
I order a salad.

ismale = false

if ismale
puts "You are male"
else
puts "You are not male"
end

ismale = false
istall = true

if ismale and istall
puts "You are tall male"
elsif ismale and !istall
puts "You are a short male"
elseif !ismale and istall
puts "You are not male but are tall"
else
puts "You are not male or not tall"
end

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0