Ruby - Statement elsif statement

Introduction

elsif means "else if":

Demo

fruit = "orange" 
if fruit == "orange" 
 color = "orange" 
elsif fruit == "apple" 
 color = "green" 
elsif fruit == "banana" 
 color = "yellow" 
else #  ww w  .  ja va2s.co m
 color = "unknown" 
end

Related Topic