mardi 24 octobre 2017

if-elsif without conditions not branching correctly in Ruby

When I run the following code:

if  
  puts "A"  
elsif  
  puts "B"  
end  

I get the output:

A
B

Why does it not warn or raise any errors? And why does it execute both branches?

Aucun commentaire:

Enregistrer un commentaire