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
- Open your terminal.
- Navigate to that directory using
- Execute the file using
- Switch back and forth between the text editor and terminal, so you
can make small changes in your code, and then run it through
rubyto see what it does.
In order to switch back and forth between apps quickly you can use the keyboard
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
and then enter to run it again.