Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Welcome back, everyone.
2
And today's oratorio, we'll talk about primitive types in order to talk about primitive types.
3
We'll be using Wrex Tester to provide some examples.
4
So before we get into the types, let's talk about variables and constants as we will need these variables,
5
variables or something you declare once throughout the program.
6
And you can be they can be changed throughout the program.
7
So variables are declared once and can.
8
Be changed later on.
9
And then we have constant.
10
And constants are declared once and can not be changed later on.
11
So this is declaring clarinet cost, and we'll begin with the keyword.
12
KONST And then let's say an integer, and then let's just declare a simple integer up here.
13
But first, let me explain the naming conventions, naming of variables or constants.
14
So this is how you want to be naming your declared variables.
15
So pretty much they have to start with the letter and then they can be followed by either a number or
16
an underbar.
17
So let me declare a simple integer or so, and my end is equal to one.
18
You can also declare it, but I think int my int is equal to two.
19
And then you can also do int my.
20
And one is equal to three.
21
So these are all possible ways of declaring something, pretty much.
22
So let's also do that with our constants.
23
However, I like declare my constants in all caps because they stand out and you can tell which item
24
is of constant or not.
25
So let's say a const and.
26
And then this is equal to a hundred.
27
So these are all possible declarations of your
28
integers or, you know, whatever you're declaring.
29
So that's that's those are the basics of how you can declare items.
30
They have to start with a letter and then followed by either an underbar or a number.
31
These are possible.
32
They don't have to, but they can be.
33
So can be.
34
So now let's talk about our primitive types.
35
These range from.
36
So let me let me write them down.
37
I'll be doing and float character.
38
Let me throw in double right after float, and the most simplest of them all is bullion.
39
So let's go through an integer.
40
So and by default are 32 bits.
41
And can hold numbers from a big number, so bear with me.
42
Negative 12.
43
Excuse me.
44
That's not 2000.
45
It's I think it's in the billions.
46
Four, four, eight, three, and then six, four, eight to positive.
47
OK.
48
You know, first.
49
No, I don't I don't know the exact way of pronouncing it, so I'm not going to try.
50
And then six forty seven.
51
So that is the range of what an integer can hold.
52
It is by default signed.
53
Which means they can have a negative numbers, as you may say.
54
So know, let's declare let's do have a constant and a nonconsent of it for all of these.
55
So that's the end
56
and end.
57
It's equal to one and the cost and
58
the constant in, let's say.
59
It's equal to two.
60
So that's that's pretty much an end.
61
That's pretty much what it will be.
62
So let's move on to a float.
63
So floats are by default, 32, 32 bit as well.
64
And they can hold.
65
Approximately negative three point four times.
66
Let's see, I think it's 10 to the 38.
67
And then two positive three point four times ten to 38.
68
So a pretty, pretty big number.
69
So how do we declare these is the same thing?
70
Float a float is equal to two point five, six.
71
And that, of course, they have to be followed by us.
72
So let me write that down or ends with F.
73
Other why is it.
74
We'll assume it's a double, which A is just a much larger version of a float and a float also has is
75
accurate to seven decimal units.
76
So one, two, three, four, five, six, seven.
77
So that's as far as as accurate as all get that constant flow float.
78
My float equal to two O two point one, two, four, one five, so on.
79
So lots of float.
80
Let's go with the double.
81
They are 32 bits.
82
So these are excuse me, 64 bits.
83
Hence them being larger than a float.
84
Let me write it here.
85
Decimal.
86
So there are 30, 64 bit decimals, these hold very, very, very large number that I will not write.
87
And they are accurate to.
88
15 to 16 decimal units.
89
So double, let's say a double.
90
To your point, you know something?
91
These do have the option to end with enough.
92
They don't necessarily have to, but it's it's a choice.
93
But I wouldn't it's it's not necessary.
94
It's just, you know, it's possible.
95
Then my double.
96
There you go.
97
That's that's a double for characters.
98
They hold one value at a time and they can be anything from a letter to simple.
99
And so let me let me go ahead and write that down, so character my car, a sequel to a then you can
100
do a constant character, my care, my.
101
Const.
102
Care to signal to be actually, let me do this just to show that.
103
Cost constant, constant.
104
If Cosmosphere requires a value to be provided.
105
I think this might be it.
106
Constant.
107
I declared it costs and somewhere that I.
108
Need to take back pretty much.
109
That's the area that I'm getting in, constant fear requires a value to be provided.
110
Oh, excuse me.
111
Right here.
112
That should fix it.
113
And I believe this can be enhanced as well.
114
So let me put that back up there.
115
So that's that's a character, Ken, one item at a time if you try to do to get in there.
116
So now let's go to bullions.
117
So Bill holds the value of true or false, and he sort of declare the same way, a bully in my bull
118
sequel to True and have a constant one.
119
That's true.
120
Cost and Boulianne I.
121
Which is equal to.
122
False.
123
There you have it.
124
So these are our most basic types, the simplest ones like I can come off my head.
125
There are slightly different versions of.
126
So write these down right below.
127
By doing this.
128
So we have let's go with a eight bit version of ANENT.
129
The ancient version of the end is called a bite.
130
So these are by default signed excuse me, on signed.
131
So I'll bite my bite is equal to
132
so 120, the range here is from zero to 255.
133
And then we can do a constant of these as well, so constant.
134
But my cost bite sequel to 255.
135
So now we have a I forgot to write the eight right there.
136
So sixteen bit.
137
Version of and it's called a short.
138
And this goes from negative, so range is negative 32.
139
And let me see the actual number behind it.
140
Oh, 32.
141
I'll come with it in a bit.
142
Six, seven, eight.
143
Or excuse me, seven, six, eight two thirty two, seven, six, seven.
144
So this is the actual range.
145
It is by default.
146
Of course, signed, as you know, we have a negative up here, so it's got to be signed.
147
So short my short cycle to only 200.
148
Then costs.
149
Short, I can't short.
150
And that makes us think of 32.
151
And I forget the equals sign here, and then our last one is a 64 bit version of an ant.
152
And this is called a long.
153
The range on the long is quite big, so I'll short it by going with negative nine point two times 10
154
to the 18 to nine point two times 10.
155
To the 18 as well, so that is the range.
156
So it's long mile long and quite big number, I believe.
157
I think that might be big enough.
158
Yep.
159
So then caused along.
160
I cast long.
161
I think that should be within range.
162
And so vengo.
163
So these are are different versions.
164
Of a far integer, pretty much.
165
And then we have unsigned versions of these, so.
166
Let me make a comment on Scient versions.
167
So we have you and you long and you short.
168
So these are all unsigned.
169
So meaning they go from pretty much zero to double of what their number is.
170
So it's a short will go from zero to about 6400 or 64000.
171
Excuse me.
172
So these are also they're declare the same way.
173
So you and I, you and as equal to, you know, something positive has to be a positive number.
174
Otherwise, they will not accept it.
175
Short by short, you short
176
and then something.
177
So if I put a negative here, it'll give me an error, as you may see.
178
And then you long my along as you go to some number.
179
We also have a signed version of our Vyt, so let me put this a signed version of it.
180
And this is called as bait.
181
And it's slowly just as bite.
182
And then my -- bite to negative one toe the range here.
183
Is one negative one to eight to one.
184
Twenty seven.
185
So that's what we have.
186
So again, I'll repeat this again.
187
Don't go.
188
I think I've repeated, if I haven't, I'll say it, I'll say it once.
189
So let's talk about overflowing.
190
I don't think I've actually said it, so I'll do.
191
The stumbling over flowing is when you try to assign a type a value to large for the container.
192
So an example of this is let's go with a bite equal to one twenty nine cents, a nice bite goes from
193
one twenty eight to one twenty seven or negative, 128 to 127.
194
129 should be too large for it to hold till we get an error here if I drop this back to 127.
195
It shouldn't work.
196
Oh, excuse me.
197
I have to say, we have to have a variable or a name for it.
198
My bite.
199
And then let's just do another one.
200
So let me do that again to 129.
201
We should get an error.
202
It's too it's too large for it to hold, so it cannot hold it.
203
So I'm a coming this out as an example.
204
So that is what overflowing is a stubborn about excuse me, let's talk about scoping.
205
So scoping.
206
Is trying to.
207
Well, it's not really something, it's just a school with scope is where you can access.
208
Variables or values, pretty much so values, because you can access costs as well, we can access values
209
from.
210
And so let's let's let's give you a let me give you an example.
211
So if we have a statement, I'll be using F statements.
212
So I have to tell you what they are.
213
So they are statements that if a condition is met, a certain task will be done.
214
So let me let me say and test.
215
And it's equal to 10.
216
If test and is equal to 10.
217
So the difference I'm going to tell you the difference between this equal sign and this equals sign.
218
So this equals sign says that tests aren't as equal to 10.
219
This equals sign as checking.
220
Checking if test.
221
Pente is equal to 10.
222
So if I made this.
223
Let me finish a statement first.
224
So let's say if it is equal to 10, let's have the console, right?
225
I'm 10.
226
So so this should one should say I'm 10, not to make this zero.
227
They should not run into that.
228
So it's pretty much checking for a condition.
229
The condition is here where the tenant is equal to 10.
230
So Nutro.
231
So let me go back to scoping.
232
So scoping is where you can access a value from the if statement as within the the main function.
233
So if statement will have any will have access to anything above it?
234
Pretty much so.
235
Anything declared above it, I'll have access to.
236
So let me go back to my end to one.
237
I'll change it.
238
And that point it again.
239
So I'll print first.
240
Let me have the console.
241
Right.
242
So on the right line, my end should print one.
243
It's capital I.
244
So am I, and a third one.
245
And now if we added my end so my aunt is not equal to 25.
246
And now let's write it again.
247
My.
248
And so now I should have won and then 2005 at the very end, because we can edit it, we have access
249
to it.
250
So now let me declare an integer here.
251
So and new.
252
And it's equal to negative to negative one.
253
All right.
254
And we can run it.
255
That's fine.
256
So now let's try to access that integer from outside of here outside the statement.
257
So let's say you and it's now equal to 20.
258
It'll give me an error because I'm trying to access it outside of the scope of it went.
259
And the nuance scope is only for the statement.
260
So I can access it only within here.
261
Or if I were to declare something within here.
262
So let's say if.
263
Let's say to a bully, and so let me declare bully in my
264
no bull.
265
So my new bullion is equal to true.
266
So if my new bullion sequel to True, this can also be done this way.
267
So let me show you another example.
268
If my new beau that checks, if it's true, Salame check for true.
269
And then this will be for a false.
270
So exclamation mark.
271
So my.
272
No bull.
273
This would be.
274
For false.
275
So this is just another way of doing exactly what I did here.
276
So let's say let's do that so minuet.
277
So let's change Menuet now.
278
And now it goes to negative 10.
279
And let's have concentrated.
280
New and.
281
The comment that out.
282
So as you may see, this is within the scope because everything that I'm using here is declared above
283
it within this here, within the these brackets.
284
If I try to exit here, I'm outside of the brackets.
285
And so I'm outside of the scope because it was declared here.
286
Now I can access this integer if I declare it above.
287
So let's move it up there.
288
This will give won't give me an error anymore because it's declared within its own scope.
289
So this would be in scope of this.
290
Tell me, move that back over here.
291
All right.
292
So that is pretty much scoping and what you need to know about it.
293
Finally, put this an example of.
294
Of that scope.
295
All right, so that is pretty much what you guys need to know about, you know, primitive types and
296
scoping and overflowing for you guys, I would like for you all to mess around with it, have some fun.
297
Used to have statements.
298
There are, you know, right now one of our first big things that we're learning.
299
So play around with it, mess around with it, declare your own your own variables, get familiar with
300
the naming convention.
301
You know, you can do many things with it, but just go around going back on to mess around with it
302
and just have some fun.
303
So that concludes for today.
304
That concludes today's video and the next tutorial we'll learn about type conversion.
305
Thanks for watching.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.