Expressions, Conditionals, and Loops
Single terms in an expression may be any of the following:
-
Literal. Ruby literals are boolean, numbers, strings, arrays, hashes, ranges, symbols, and regular expressions. These are described in Ruby Literals.
-
Shell command. A shell command is a string enclosed in backquotes or in a general delimited string starting with %x. The string is executed using the host operating system’s standard shell, and the resulting standard output stream is returned as the value of the expression. The execution also sets the $? variable with the command’s exit status:
| filter = "*.c" |
| files = `ls #{filter}` |
| files = %x{ls #{filter}} |
- Variable reference or constant reference. A variable is referenced by citing ...
Get Programming Ruby 3.3 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.