If statements

feelo31

Felix Imbanga

Posted on March 20, 2024

If statements

Type end immediately after typing the if. Indent
elsif is only when you need to check more than 2 conditions.
Causing code to execute is known as 'truthy'
Causing code to not execute is known as 'falsy'
Only nil and false are falsy.
!= means not equivalent
p if for quick inspection, pp is for more human readable representations. especially with complex data structures.
In variables you can put methods on both sides to evaluate if statements more concise.
&& both statements have to be true
|| at least one statement has to be true.

💖 💪 🙅 🚩
feelo31
Felix Imbanga

Posted on March 20, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related