From the course: Computer Science Principles: Programming
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Create conditional tests
From the course: Computer Science Principles: Programming
Create conditional tests
- Computers process in binary, ones and zeros, true and false. In programming, you need to think in binary as well. When you create code that does different things based on data, you are creating a conditional. You create the condition, or the test, and you find out if the test is true or false. If it is true, you do one thing. If it is false, you do another. The idea of true and false is the basic building block of computers, so in programming there is a special data type designed exactly for this, a Boolean value. A Boolean variable can be assigned one of two possible values, true or false. I can also create a function that returns a Boolean value type as well. I can also create an evaluation, but I need to use a different set of operators to do the evaluation. Regular math operators, like addition and multiplication, don't give me a true or false answer. Instead, I need to use equality operators. In programming, there are six to choose from. I can ask if one value is equal to…
Contents
-
-
-
-
-
(Locked)
Capture input from the user3m 31s
-
(Locked)
Manage different variable types2m 4s
-
(Locked)
Create conditional tests4m 39s
-
(Locked)
Build compound conditional tests4m 19s
-
(Locked)
Use while loops2m 11s
-
(Locked)
Use for loops3m 11s
-
(Locked)
Create arrays to store groups of values2m 28s
-
(Locked)
Use loops with arrays2m 5s
-
Changing arrays2m
-
(Locked)
-
-
-