Solution: Generate Lotto Numbers
Go over the implementation of the lotto number generator.
We'll cover the following...
Solution
Press + to interact
count = 0array = []until count == 6lotto_number = rand(49)lotto_number += 1if array.include?(lotto_number)# Number already exist"nextendarray << lotto_numbercount += 1endputs "Your winning lotto numbers are #{array}, good luck!"
Explanation
Line 3: We use the
until
loop instead of awhile
loop. This is equivalent ...