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 ... |
Get Ruby Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.