Course C Initial 9th – If-else Selection Command.

Lesson 9. Note: for this lesson or the next, you need of all saw up to here.
With all that we saw up to here, we can go on to an important thing when we’re programming. How can I use conditions in my code? Well, maybe I don’t run the code fully, so, what can I make? To answer those questions is that I present to you the study about Selections Commands in C language. There’s two selections commands in C, if-else and switch, we’ll see both. But now, we’ll see if-else.
First understand the structure:
if (condition is true) {
#commands

}
Can you understand? The if command verified if the condition is true, if it’s, so run, else run other command if it there.

Analyze the condition below:


Else is for the moment that if is false. In some case, problems can be solved with else, it cans economize data.
Make an algorithm that test 3 numbers typed by user and print the greater.


For the test, will be used logical commands. So, let’s go.



In this case, only the third condition was true. Train with these thing presented in this lesson. In the next lesson, we’ll make some exercises to practice this lesson.
That’s all folks!
See you later!

Comentários

More Famous Posts

Course C Initial 7th – Training with Math

Course C Initial – 3rd Variables Part. 1

Course Python For Life 3 – Input Command