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 # from ww w.j  a  v  a  2s. com
 color = "unknown" 
end

Related Topic