Exercises
If you haven’t done the try ruby course already, we recommend you do at least a couple of lessons over there too.
Whenever you sit down to do some of the exercises in this book make sure you have your text editor and terminal open. In your terminal:
Create a new directory where you want to keep Ruby files for our exercises. For example:
~/ruby-for-beginners/exercises
. In order to create that directory in the terminal you can run:mkdir ~/ruby-for-beginners/exercises
.Then navigate to this directory:
cd ~/ruby-for-beginners/exercises
In order to check if you are in the right directory you can always run:
pwd
. (That’s short for print working directory, meaning, it prints the name of the current directory.)In order to see all the files and subdirectories contained in the current directory you can run
ls
.
Credits: The exercises 1.1, 1.2, and 2.1 are taken from Introduction to Ruby.