Getting Started With Ruby - A Tutorial For Beginners
Getting Started With Ruby - A Tutorial For Beginners
You’ve a lot of learning ahead of you, but don’t let that stop you from
getting started.
Now:
Things like:
Variables
Data structures
Conditional statements
You’ll find a lot of new words in your journey, don’t worry about that,
you’ll learn along the way.
But if you make that kind mistake in Ruby, or any other programming
language, you’re going to get an error.
https://www.rubyguides.com/ruby-tutorial/ 4/10
03/04/2024, 12:11 Getting Started with Ruby: A Comprehensive Tutorial for Beginners
But you’ve to understand the rules of the language, then apply them
correctly.
I’m telling you this is because I don’t want you to give up early if you’re
seeing a lot of error messages & if things don’t make a lot of sense.
It’s normal:
You are learning something new & it’s going to take some time
until it starts to sink in!
Work on every concept until you understand how it’s useful in the big
picture, how to use it, how to explain it to other people.
This Ruby tutorial helps you learn step-by-step, so don’t skip steps.
Invest as much time as you need, have patience.
Ruby
If you are using Windows you want to go to this site to download Ruby:
https://rubyinstaller.org/downloads/
You want the recommended version (it’s in bold text), which at the time
of this writing is Ruby+Devkit 3.2.2-1 (x64) .
Now to start writing your Ruby programs you will need to open a
terminal
https://www.rubyguides.com/ruby-tutorial/ 6/10
03/04/2024, 12:11 Getting Started with Ruby: A Comprehensive Tutorial for Beginners
terminal.
At this point you should be able to type ruby -v inside this window,
press enter, then you should see the current version of Ruby printed on
your screen. This means you are ready to start writing Ruby code.
If you are on Linux or MacOS then you probably already have Ruby
installed.
Like this:
If you don’t see a Ruby version then refer to this site for more details on
how to install Ruby for your particular Linux version or Mac.
This is a Ruby program that allows you to type Ruby code & see the
results right away.
To open irb you have to type the word irb inside that black
https://www.rubyguides.com/ruby-tutorial/ 8/10
03/04/2024, 12:11 Getting Started with Ruby: A Comprehensive Tutorial for Beginners
Press enter.
1. irb(main):001:0>
1. 5 + 5
Of course.
The point of this is to get you used to typing inside the terminal
window.
And you’re going to be using numbers a lot inside your Ruby programs: