jeudi 8 avril 2021

Else block in Ruby

I just started learning ruby, but there's something I noticed. In JavaScript the else block isn't really needed. So you can do something like

if (condition){
    // do something
  }

//do something else

instead of

if (condition){
    // do something
  } else {
  //do something else
}

is this possible in Ruby ?

Aucun commentaire:

Enregistrer un commentaire