rubyonrails

Curiosidade Ruby do dia

Não existe ‘else if’ em Ruby e sim ‘elsif’ – sem o ‘e’ mesmo! Isso costuma pegar alguns desatentos. Veja o exemplo:

if numero == 2
   print "Número é 2"
elsif numero == 3
   print "Número é 3"
else
   print "Número não é nem 2 nem 3"
end

Existem outras características interessantes na linguagem.

Avatar photo If you like my content, follow me on Twitter and GitHub TwitterTweet

Interactions

Webmentions

Comments

comments powered by Disqus