Lets revisit Koadbles

Ms. Jen’s Class here is your class code classv54

Ms. Cooks Class code classv48

Mr. Mac’s class code classv52

Conditions what are conditions?

What is a condition?

Conditions (conditional expressions) are the second of three basic flow control structures in programming. Like sequence, conditions influence a computer program’s decision-making process.

“If, then” Statements

Also known as “if, then” logic statements, conditions enable a computer program to act differently each time it is executed; depending on if an input is evaluated to be either true or false.

In a programming language, conditions are classic “if, then” logic statements and possess both a hypothesis and conclusion.

Here is a chart that uses the simple algorithm of making  a PBJ Sandwich.If   all   the conditions  are met  in   Sequence  then  you  can  make  a PBJ  sandwich.

If the user taps “Play,” then they will be able to start playing Kodable.
If the user taps “Choose a lesson,” then that will enable them to select a particular lesson to play.

Evaluating Conditional Expressions

In order to prepare our peanut butter and jelly sandwich, we had to evaluate whether or not the necessary conditions were met as we progressed through our algorithm. If any of these conditions were evaluated to be false, then our peanut butter and jelly sandwich could not be made.

The exact same principles apply when using conditions in computer programming:

Simple Conditions: Passwords

A classic example of a simple condition is a password. A password secures your computer and all of your personal information. When a user enters a password, the program needs to evaluate this input, and check whether or not the password entered matches the correct one saved for the user.

Hypothesis:

If the user input matches the password stored in the database…

Conclusion:

then the user can access their profile and personal information.

Rules

A rule is a set of guidelines in a programming language that instruct a computer program what operations to execute or perform. For example, the rule in a password program is to never let users access secured and private data.

Conditions modify programs and are rule breakers, or exceptions, to the rule.

For example, we would create a condition for a password program that would enable specific users to access their secured information.

 Hypothesis:

 If a user input matches the password stored in the database…

 Conclusion:

 …then the user can access their secured profile/information.

Show Less


Conditions Vocabulary

Terms and Definitions

  1. Condition: A condition is an exception to a rule, and is also known as a rule-breaker. A condition in program allows the program to perform different actions, depending on the condition being true or false.
  2. Conditional Statement: A conditional statement allows programmers to develop more dynamic programs by breaking rules. Conditional statements are “If, then” statements: If a condition is true, then do _(x)_.
  1. Username: When used with a password, allows a user to log into the database and access information. A rule-breaker.
  2. Password: When matched with a username, allows a user to log into the database and access information. A rule-breaker.
  1. Rule: A rule is a set of guidelines in a programming language that instruct a computer program to execute or perform certain operations.
  2. Exception: Excluded from a general statement, does not follow a rule. A condition is an exception to the rule.

  3. Rule-breaker: Exceptions to the rule. An example in programming is a password.
  4. “If… then…” statement: A logic statement, when used in programming enable a computer program to act differently each time it is executed depending on if an input is evaluated to be either true or false.

Show Less

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s