Hello and welcome to this lecture in this lecture.
Be showing you how to interact with Ruby using the interactive Ruby Shell also referred to as I R B.
What is interactive Ruby interactive Ruby is a program that outputs or shows the results of any ruby
statements that you feed to it or give to it.
So any statement you write within the interactive Ruby console it all out pulled the result in the way
it works.
Like he cark later that outboards whatever you put into it.
There are different ways you can access the interactive Ruby base on the type of operating system or
computer you have.
If you are on his Mac OS X you basically typing Hi hard be on the terminal and that will give you access
to it.
If you are running Linux you open the shell and type in hi.
Ah B.
If you are running Windows there is an interactive Ruby icon which is located inside the ruby folder
in your program's files.
I am on a Windows based computer so I'm going to go to my files and there is my ruby folder inside the
room before there.
There is a folder court interactive Ruby this icon here.
I just click on that and that will launch my interactive Ruby interactive Ruby is cat like a quick way
to get acquainted with certain commands.
Ruby So if you got single commas you one test out why your bidding application came quickly.
Time the command to an interactive Ruby and it to just return an output.
Say a good playground to experiment to begin.
I'm going to type in the command where you see the cursor flashing.
That means he's waiting for some command.
So I'm just going to type in a text.
I am going to type P in hell a word.
If you're using a if you type in a string.
You have to enclose that in quite a string.
Basically is the text says he held a wall and press and time the keyboard and is giving me hell a while
back.
So a busy akeley obeys your command so whatever you tell it to do it will help put the result for you.
So when you use when you say Hell a world there it gives you hell awhile back.
Let's write another one this time we are going to use.
He put a command so when a typing puts followed by a space and then quotes type in hell of world.
Hello world.
Press and tap on your keyboard.
If you notice a difference when you use the Puts there are no quotes.
If you listen here I just typed in hellowallet and interactive show business you just repeated what
I typed in.
You can see his written.
But when I use the puts Command put put basically a command that is used to display output on the screen
he has not returned the output with the quotes.
Notice a quote I'm not here.
So if you want to output anything on the screen using Ruby you use the puts we use.
Put it also once he returns it outputs.
He can also give you a carriage return.
Also notice this here this is nil.
I didn't get that when I just typed in the hello world.
Well when they use puts I get this also has return the value is also giving me this name here.
Neil is basically the result of the expression.
Okay.
So when you're using puts it will always return.
Value of Neal Neal means nothing.
It's not a value.
It is nothing.
Let's try a few Appalachian sad to see seven plots seven.
If you notice it's just return value.
There's no Neil involved.
If I do put this time to say seven.
Plus 7.
Notice the nil.
So when you use the inputs it will always return that nil value which means absolutely nothing.
That's how it will express itself.
You can do all kinds of calculation on here mojos addition so you can do multiplication as well if you
wanted to do multiplication of 5.
In Ruby do the multiplication symbol is an asterix to do Asterix times 5.
That will give you a return 25.
All right.
Let's experiment with a couple more commands.
So I'm going to typing in another command here so I'd do a double quotes.
Hard typing 0 0 p.
Ha.
Hey hey.
For opera I am going to use the dot limberness say reverse.
So what I'm seeing here I am.
Everything in Ruby is an object so I'm telling you I'm telling the object to reverse itself.
Okay I'm using the dot notation to tell it to revert it is the DOT that does the reverse and so I press
Enter hard proud turns to harpole.
Another command you can use See for example.
Have quite helo in low I case.
Want to convert that to our per case.
I just type in use the dot notation and do you.
P case press and to conveyers that to uppercase so interactive shell is a good way to learn about single
commands in Ruby so you can test your commands.
Play around with different things before you start writing a full statement in your text editor persuasive
him very quick and use for play playground.
Also notice the difference between the puts.
When you use the ports it will always return a return value with that is nil.
I have tests on the output so that's the difference between use in the I and not using the port so feel
free to play around to a loft in New Addition.
Everything single line commands are quite useful so feel free to play around with any commands that
you come across that you can use in Ruby.
So that's it for this lecture.
Thanks for watching.
Bye for now.