Programming Course. The basics of Programming.
#16 If Statement
Learn to code.
The If Statement.
Asking something useful to our code.
What is, the if Statement?
We need to start asking questions!
Something like. If the Bank balance is positive, Calculate interested, if is negative, charge a penalty.
We need to write code that sometimes runs, and sometimes don’t. Depending on the conditions of the program at the time. This is conditional code.
The if statement is identical in other c based languages, using this format.
You can see a few spaces and a line breaks that i put it in, just to be more clear.
So we are using the word, if. A pare of parenthesis. And a open and closing, curly braces.
The general format is, the word, IF, some condition is true, then do what ever codes goes between the open and closing curly braces.