What is the point of writing both if and unless espressions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the point of writing both if and unless espressions?

In ruby sololearn unless and if expressions section they use both if and unless expressions. Was it just to give an example of both or was it for a specific reason?

31st May 2018, 1:37 PM
Shyiva
2 Answers
+ 4
It is an example, which explains those concepts (and difference between them) more clearly. Using both or either one of them depends on you and your code requirements. Remember, the unless expression is the opposite of an if expression. It executes code when a conditional is false.
31st May 2018, 2:54 PM
Dev
Dev - avatar
0
Thank you that was very helpful
31st May 2018, 3:58 PM
Shyiva