Hello and welcome to this leg shot in this lecture.
I'll be talking to you about variables in the Ruby programming language.
What is a variable variable.
Basically is a memory location.
Irish place that holds any day tiny piece of data that can be use by a program or any program.
It variable is also a name that Ruby associates with a particular object variable names should be lower
case whereby you have variable names that contains two word is best to use an underscore to separate
the words.
For example he may have a variable called Order mount.
Bessie is an on the score to separate the words.
Unless you intend to give it it's just one word.
In that case you can call it total for example variables in Ruby can contain any data types so you can
have a string or an integer.
Also when you name your variable give them common sense names that reflect what the variable doors or
what day to day hold or store.
You can not use reserved names in the Ruby programming language for variable names for example you can
call it variable class method on module.
These are all reserved words that are already used in the Ruby programming language.
These are just a few examples.
If you want a detailed example Reserve word you have to reference the ruby documentation variables in
themselves and not object by references to objects in the Ruby programming language before you can use
a variable.
You must assign or give you the value variable that hasn't got good value is referred to as on defined.
What is an assignment and assignment basically is some operator that is used to give variables in value.
Okay.
Usually you identify that with the symbol the symbol for an assignment operator is equal to say.
So let's take a look at a couple of examples.
First here I've got a variable called X..
We've signed it off 7 0 got another variable cuong greeting me assigned it to a value of Hello.
So let's say you use the assignment operator.
I've got my interactive Ruby open.
If you on a Windows This is located in your ruby fault in our program.
If you are on here Linux or a Mac just type in our being in your temin or shell that should give you
access.
Let's create some variables.
And when I create a variable context and give it a value of 7 I create on a pillow variable call.
Why I give this value or if I create another one chord set and then give this the value would be x plus
why that give 15.
So if I type in there is to output 15.
You can also change the value of a variable once you've assigned to value for example I can come here
and change decks to ecorse to instead of being 7.
I can make x 15.
So now I can see the Z course to X class Y.
That will no longer give me 15.
Now what is it all value.
This should now change and give me twenty three so if I type in there the new value for Z is 23 so you
can always change the value once you've given a variable name.
So let's create another variable.
Core is greeting.
Can I just give you a valley of say hello.
So if I want a reference that I just typing puts followed by the word greeting and that does give me
hello.
So if I wanted to change the value of that greeting I just can't taiping greet in ecorse too.
How are you.
Okay.
Now if I'm typing greeting I should get how are you.
So why should you assign values you can always change them so feel free to experiment creating.
Boer's a sign of a bad to that.
So that's it for this lecture.
On their reports.
Many thanks for watching.
Bye for now.