Afrikaans
Akan
Albanian
Amharic
Arabic
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
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
All right, so we're back and in one of our previous examples, I think it was in our previous video,
hopefully if everything is arranged correctly, we talked about how we can implement these even function.
Any of these video I want us to do is simply to implement another function in this function will be
called Is Khaled OK?
This will be the name of the function.
And this function will what it will do is just this function will receive an integer, OK, and it will
return one if this given if this given number is order.
All right.
And otherwise if it's not odd, meaning if it's if this number is even otherwise, this function should
return, should return zero.
OK, so if it's even if it should return zero.
All right.
And I want you to take also a few minutes to think about it.
I think it's very trivial to solve it.
We are going to solve it in two different ways.
So start with the most basic, with the most intuitive solution and simply write write it down pretty
much like you've done it for even just change a couple of lines to make it suitable for is odd.
OK, so take a few moments and we will continue right away.
Awesome.
So let's start in.
The signature of the function is going to be pretty much the same except just the function name.
So it is odd and the function is going also to receive a number.
So it's not like we do not really care about the fact that these function uses these even are this function
is even is using enum and also that this function is odd is using enum.
Basically, we know that these functions can be treated like different rooms and different rooms have
their own naming for the values they are using.
So it is odd and the function goes like this.
So if no modulo two does not equal to zero, which means it is an odd number, then in this case simply
a return one.
Otherwise return to zero.
OK, so pretty much almost the same solution as it was previously.
Just that here we used the inequality sign and here we used the equality sign.
Here it was regarding even numbers and here it's regarding odd numbers.
OK, so if the result of the condition here is true, then these will be executed and it will mean that
the number itself is even in here.
It will mean it's odd.
OK, so I hope this standard solution is clear to you.
And I'm going to show you also additional option to how we can, instead of writing down the body of
this function like this, how we can use the fact that we how we can call this function is even and
implement these odd function by using these even.
OK, so that's right.
Additional function called is odd number two and it will simply look like this.
So isn't odd.
It is odd.
Let's call it two and it would receive also none.
And now what this function is going to do is simply to call the even function and to basically to decide
what it should return based on the result given from is even function.
So for that, let us go like this, so if is even returns us one for a number, right?
So if it returns this one, it's right down in the parentheses here.
OK, so if it returns this one, then what it means is that the number is even an hour is odd to should
return to zero.
Right.
Because it's odd returns zero if the number is even.
So based on the call of this function is even with numbers.
We know that, we know that these function returns one only if it's an even number, then in this case
this is all the function should return zero else we know or else we know that the function should return
one.
So is that clear to you guys?
What do you think?
Do you agree with the second solution?
I agree that the first one looks easier, but here you practice the way you call another function.
OK, so first of all, you will call these are two, you will give it to another.
And here behind the scenes, this function will use a totally different function to like to calculate
something or to check out something in based on the result of this function, you will return some value
of this current function is odd to.
So I hope this is clear to you because that's also very important.
Like to grasp the idea of calling another function from a given function.
And that's something you're going to do a lot in your programming career because you're going to write
also complicated functions that will require the usage of other other functions in order to construct
them.
And with that being said, guys, I hope you like this video.
Let me know what you think of it.
If you have any questions, leave some review.
And of course, as always, and we'll see you in you in the next video is I think there are a lot of
prak.
There is a lot of practice to us.
I'll see you then.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.