if name=='peter'
...
elsif name=='john'
...
end
vrijdag 5 juni 2009
The else if in Ruby
The basic if structure in ruby looks like listed below. Especially the 'else if' is uncommon: elsif.
Abonneren op:
Reacties plaatsen (Atom)
2 reacties:
I think it needs to be :if name == 'peter' puts nameelsif name == 'john' puts 'Superuser '+nameend
What your trying to do is to set the name variable in an IF, not very good!.
CodeJoust
sir.lain is right, it should be == and not =. I changed it.
Een reactie plaatsen