All language subtitles for 16. Increment and Decrement Expressions

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

0 Now so far what we have seen are all operators that exist in normal mathematics. 1

But here are some that only exist in programming. 2

So take a look at this expression. 3

We create a variable called x and we set it equal to 5. 4

Then we change the value of x to the previous value, which is 5, plus 1. 5

So x now equals 6. 6

Now we've seen this and we've been using this in our previous code. 7

So this should be familiar to you already. 8

But in most programming languages, instead of writing out x = x + 1, you can simply write 9

x++, and, in exactly the same way, x now gets incremented by 1 and is now equal to 6. So x++ 10

is the equivalent of saying x = x + 1, and this is called the increment expression. 11

Now you can go the other way as well. 12

You can write x--, 13

and this is equivalent to x = x - 1. 14

So the previous value of x, 5, minus 1, so x now equals 4. 15

And this is called the decrement expression. 16

Now you might have heard of the programming language C and C++, and this is kind of like a programmer's 17

idea of a good joke, even though nobody else thinks it's funny. 18

But essentially C++ was meant to be an increment on the C programming language. 19

So it's kind of like C plus one, a little bit better than C. Remember that with ++ and --, 20

you're only ever changing the value by one. 21

Now if you ever want to increase the value of x by more than one, then you can use the +=, and 22

this is equivalent to saying x = x + 2. 23

And so x now equals 7. In the same way, 24

you can also use += to increase by the value of another variable. 25

So in this case x = x + y, which is equal to 8. 26

And this also works with -=, *=, /=, 27

and it's a handy shorter way of doing exactly that. 28

So, in the next lesson, 29

I have a brief quiz for you to see if all of this stuck 30

and if it makes sense. 31

So head over there and see if you can complete the multiple choice question and I'll see you on the 32

next module.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.