Blocks or simply chunks of code as in the last example may be existing variables which changes after that same variable passes thought the block, giving it a new value. Blocks may also be used to return a needed value to the method as in the last example, the resulting value of the last expression [...]
Tag Archives: Functions
Containers and Hashes
Containers is a term used to define arrays or tables for they are used to store variables which are then indexed to be able to retrieve data from them. Hashes on the other hand can be described as dictionaries or associative arrays which are also indexed along with all object references. Arrays are indexed using [...]
Constructing Blocks
Blocks are code contained within the braces that if used with the last post’s example would be associated with the call to the function threeTimes. Within the defined method a call for yield is called three times in a row wherein each time a call to the block is sent the greeting is displayed which [...]