Syntax for the unless conditional
The unless
conditional is a popular programming process for many Rubyists. It's not required and many developers I know, even experienced ones, don't like it since it is a very different way of looking at conditionals. I'll leave it up to you to decide if you feel good about using it in your own programs. Either way, you'll run into it in a large number of Ruby programs, so it's important to at least understand the syntax.
Running Ruby files
In this section, I'm going to use a regular Ruby file because I want you to get familiar with the different environments to write and execute Ruby code. As a quick review, to run Ruby code inside files, you can carry out the following steps:
- Create a file with a text editor or IDE, making sure the file ends in
.rb
. - Open up the Unix Terminal and make sure that you're in the same directory as the file that you created. If you're new to using the Terminal, you can save your file to the Desktop and then direct your Terminal...