Programming workflow
In order to do programming excercises on your computer, play around with things you learned, and write actual, useful programs you want to learn the following workflow:
- Write some code in your text editor.
- Save the code to a file in a particular directory. The filename should end
with
.rb
. - Open your 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.
In order to switch back and forth between apps quickly you can 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 cursor up
and then enter to run it again.