- 0 is logical true.
- all parts of logical expression with | and & are evaluated.
guessnumber.rb: game where player have to guess a number from 1 to 10.
yeld
in caller calls the code block.
fourperline.rb
: print content of an array of sixteen numbers, four numbers at a time, using justeach
. Than do the same witheach_slice
inEnumerable
.hashtotree.rb
: aTree
class with initializer accepting nested structure with hashes and arrays like this:{ 'grandpa' => { 'dad' => { 'child 1' => {}, 'child 2' => {} }, 'uncle' => { 'child 3' => {}, 'child 4' => {} } } }
.simplegrep.rb
: a simplegrep
that prints lines of file containing a phrase in that line using a regex match, include line numbers. Example of usage:./simplegrep.rb loremipsum.txt "int[a-z]ger"
- n/a
csvrow.rb
: modified csv sample application to support aneach
method to return CsvRow object usingmethon_missing
at CsvRow to return the value for column for a given heading.
(eof)