Unit 3: Boolean Expressions and If Statements

Cards (15)

  • Block of statements: One or more statements enclosed in an open curly brace '{' and a closing curly brace '}'.
  • Boolean Operator ==:
    • equality operator
    • asks a question
    • determines whether the two values are equal
    • returns a truth value
  • conditional: Used to execute code only if a Boolean expression is true.
  • conditional statement: used when a programmer wants to control the flow of the program
  • logical and: Used to only execute the following statement or block of statements if both conditions are true
  • logical or: Used to execute the following statement or block of statements if one of the conditions are true
  • negation: turns a true statement false and a false statement true
  • if (Boolean expression): used to start a conditional statement. This is followed by a statement or a block of statements that will be executed if the Boolean expression is true.
  • else: used to execute a statement or block of statements if the Boolean expression on the if part was false.
  • Compound Conditional: A conditional with one or more logical operators used to incorporate several logical expressions.
  • ! logical not: an operator placed before a boolean statement that returns the negation of the statement's value
  • == is equal to: an operator placed btwn two boolean statements that returns true if both statements are equal/have same value and false otherwise
  • Blocking: the { and } symbols used in flow control statements that allows the programmer to execute a series of commands when a given condition is satisfied
  • truth value of a statement: a statement is either true or false
  • Trace Table: A chart used by programmers to keep track of the values of variables in their program.