Search Results
Searching for: Optionals in Ruby
Case Statement
Language: Ruby
Used to test variable equality for a list of values, where each value is a case. When the variable is equal to one of the cases, the statements following the case are executed. A break statement ends the switch case. The optional default case is for when the variable does not equal any of the cases.
Functions
Language: Ruby
A function is a block of code that can be called from another location in the program or class.
Exception Handling
Language: Ruby
Used to mitigate errors in code and prevent program crashing during runtime. It 'tries' a block of code that could give an error. If the error (exception) is caught, it will execute a different block of code rather than crash the program.
If Statement
Language: Ruby
The if else block controls decision making by checking true/false statements resulting in different executions of code, depending on if the result is true and if the result is false. There are three parts to the if-else block: if, elsif, and else.