September 2017
Beginner
402 pages
9h 52m
English
There are two methods, pick and roll, both of which can be called with or without the argument. These methods must be called on the class name itself, not on the value of it or a variable.
When either pick or roll is called with no argument, they return a random value, either True or False. We can see that in the following code snippet:
say Bool.pick;say Bool.roll;
When the methods are called with an integer argument, a list of random values is generated. The integer argument defines the number of elements in the list, but on top of that, the pick method adds its limitation and returns only unique values, which, in the case of the Bool class, is not more than two. Compare the results of the similar ...
Read now
Unlock full access