So.
Let us talk about the variables.
Let me link this a little bit to you.
We've talked about signals and feel well, the variables are a little bit similar to signals.
Well, signals are with wires, but valuables or stuff that run inside the code, but also they are
not directly inputs or outputs.
So first we need to understand why do we need variables?
In order to store data?
We need to store data in a variable.
And it would mean a sketch has multiple types of variables.
You remember the HDL we had and science signed.
We had a steady logic vector.
We had ideologic.
We have integers.
Well, let me compare this to you first.
In Audrina, we have integers which are in this range that they are 32 bit.
We have booleans which can take a value off either one or zero, we have Bitts, which is eight bits,
meaning they can take the Velda Prinzhorn 255 and it cannot take any negative values.
I mean, it's not like unsigned where we could take negative value as well.
A buyer can take only positive values and in this range.
A character, it's an eight bit and you can store character like ABCDE or numbers like A, B, C, D
or any of the special symbols, all of these are stories and characters, and it has eight bits length.
And there is the float, which has a really wide range as well.
And with the float, we could actually use decimal numbers.
OK, so let me try to link these two concepts together, their data types that we had in our Adreno
and in the video.
So an integer is the same as the integer in the HDL.
We also had a 32 bit integers.
So it's the same thing here.
A boolean is exactly osteological.
Remember, the logic could take a value between zero and one.
That's the same thing we call it zero boolean byte is like an unsigned eight bit and it could take value
between zero and 255.
A character is something we don't actually have an vegetal, but we could use it.
There is something called the SC table where you could map eight bits into real characters.
OK, so this is how you map characters also in detail.
We could you could create a take a look at table in order to link these two together.
But we did not get into that because in the end we try to deal with data processing, with numbers processing
more than dealing with characters and other stuff float.
It's something that we did not study in the detail because there is no float type in the detail.
You need to code it yourself.
You need to follow a certain standard and code it yourself.
So it's a little bit complicated.
And we feel this is why we avoided this large topic for now.
But in Adreno you could easily define a float number and just do some processing on it.
So right now, declaring variables could be as follows.
You need to write the type, the name of the variable and its value.
You could also just type index and just put a semicolon.
That would be enough.
But by then, X won't have any value and it will be assigned a random value from the memory.
Now you could write integer and the name of the variable, whatever name you want, or you could write
boolean float character, anything you want.
But as you can notice, integer can take value in the range we've talked about.
Boolean could take zero or one float can take decimal numbers.
So here it's one point four five.
You can use decimal numbers and character.
You could use any character you want and you would need to define it like that.
So you would need a single quotation like that and you put the letter you want to define like this.
OK, now you could also define your valuables, all of them in the loop.
It doesn't really matter.
You could write and exit and loop.
It depends on where you want to use them.
However, let's say that you have defined integer X equals four five in the set up.
And then you said, OK, I want to say X equals forty five or X equals three or equals whatever in the
void loop.
Well this will not exactly work and it will generate an error for you.
Why, because there is something called the valuable skill.
It means that the variables you define in Leupp would only be defined and seen by everything you define
in set up will be on this scene in setup.
OK, so this is the set up scope.
This is the scope.
We call this a function scope.
So this void set up is called the function and the scope of it is everything inside this curly parenthesis
right here, everything inside that the setup can use.
So let's say you say integer X equals 45 and then you say X equals one.
That equals one plus five or whatever, or F equals explosive or whatever.
This is all acceptable because all of these variables are defined in set.
Now, if you try to do this well, the X is not defined.
So it will say, where is the X?
You did not define any integer X for me.
So in order to solve this, you need to write integer X equals 45 and this X will be totally different
from this.
So you could have an X here with a value of forty five and you could have another X with the same name.
Here was the name 35 five and they won't contradict each other.
It's not the same X, OK, this is what we call a function scope.