Basic Ruby Tutorials: 01 | 02 | 03 | 04 |
Ruby has clear language structure and functionality. Developed in 1990 by Yukihiro Matsumoto. If you are old or young or in the middle, this programming language is a GREAT place to start.
Ruby comes pre-installed on most Macs. This tutorial is mostly designed for OS. For this first tutorial, your Ruby program will be in a textEdit file.
Start a command line (terminal) window. This is where you set up your ruby directory and where you will see the results of your first Ruby program.
Create a learnRuby
directory:
Enter the text below to create a new directory for your files. Enter the command, such as ruby -v
and then press the Enter/Return key.
Command prompts: mkdir = make directory, cd = change directory, ls = list contents of directory, ruby -v = version of ruby pre-installed on mac?
learnRubydirectory with the file name
test1.rbThe
.rbfile extension tells the code interpreter that this is a Ruby file.
puts
tells Ruby to display that item to the command window.
In your test1.rb file, enter the lines of code below. Save the file.
Hello You
You'll run the test1.rb file in the command window: