Posts

Showing posts with the label Statement

Ruby - Conditionals if - else - elsif

Image
Greetings!!! In this article, we are going to be talking about the control structures inside Ruby.   Control structures are really going to provide the action that happens inside   of our Ruby programs.   It's what's going to decide what takes place under certain circumstances   and the first way that we are going to determine those circumstances is   using conditionals.   So this is, if something is true, we are going to do one thing.   If it's not true, do something else. Right, that's the basic thing.   We will run one set of code under one condition, another under   different conditions.   That's why they are called conditionals.   To do that, we are going to use the syntax of conditionals, which is going to be   if and then a boolean expression and then end at the end and then in between   will be the code that we want to take place if that Boolean value evaluates to true.   So if x is equal to 1 then do ...