Reserved Words
Table 1 lists Ruby’s reserved words or keywords.
Table 1. Ruby’s reserved words
Reserved word | Description |
|---|---|
| Code, enclosed in |
| Code, enclosed in |
| Creates an alias for an existing method, operator, or global variable. |
| Logical operator; same as && except |
| Begins a code block or group of statements; closes with |
| Terminates a |
| Compares an expression with a matching |
| Defines a class; closes with |
| Defines a method; closes with |
| A special operator that determines whether a variable, method, super method, or block exists. |
| Begins a block, and executes code in that block; closes with |
| Executes following code if previous conditional is not true, set with |
| Executes following code if previous conditional is not true, set with |
| Ends a code block (group of statements) started with |
| Always executes at block termination; use after last rescue. |
| Logical or Boolean |
| Begins a |
| Executes code block if conditional statement is true. Closes with |
| Used with |
| Defines a module; closes with |
| Jumps to the point immediately before ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access