Programming Independently
Start programming independently.
We'll cover the following
You’ll want to learn the following workflow to do programming exercises on your computer, to experiment with things you learned, and to write actual useful programs:
-
Write some code in the text editor.
-
Save the code to a file in a particular directory. The file name should end with
.rb
. -
Open the terminal.
-
Navigate to that directory using
cd
. -
Execute the file using
ruby
. -
Switch back and forth between the text editor and terminal so you can make small changes in your code, and then run it through
ruby
to see what it does. -
To quickly switch back and forth between apps, use the keyboard shortcut “cmd-Tab” on Mac OSX, and “Alt-Tab” on Ubuntu and Windows.
-
In your shell, you can use the cursor up key to go through your last used commands. You don’t have to type
ruby hello.rb
again. Just hit the cursor up and then “Enter” to run it again.