June 2017
Beginner
330 pages
7h 30m
English
In working through the unless conditional, I created a file called unless_syntax.rb.
First, I create an array for our unless conditional to work with:
players = ["Correa", "Carter", "Altuve"]
I want my code to print the values from the players array, but only if the array has values in it. To accomplish this, I'm going to use the following code:
unless players.empty? players.each{ |player| puts player } end
To run this program, go to the Terminal and type ruby unless_syntax.rb.
The output is as follows:

Now, what happens if the array is empty?
Remove the values from the array as shown in the following ...
Read now
Unlock full access