Crypto-Tech

Ruby 01: Learn the Easy Way
Best way to learn basic programming skills!

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.

A Simple Ruby Program in 4 Steps


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.

1.) The Command Line Window


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?

2.) Create a Simple Ruby test1.rb File


3.) Enter Code In the test1.rb 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.

4.) Run the test1.rb File


You'll run the test1.rb file in the command window: