on condition (truthy)
Optionally evaluate the block depending on the truthiness of the supplied condition. The truthiness rules are as follows: all values are seen as true except for: false, nil and 0. Lambdas will be automatically called and the truthiness of their results used.
Introduced in v2.10
| # Example 1 | |
|
|
|
| # Example 2 | |
|
|
|
| # Example 3 | |
|
|
|
| # Example 4 | |
|
|
|
| # Example 5 | |
|
|
|
| # Example 6 | |
|
|
|
| # Example 7 | |
|
|
|
| # Example 8 | |
|
|
|