COMP 110 Lecture Notes - Lecture 5: Type System
Document Summary
The equal to operator is =: two equals symbols side-by-side can be read as "is equal to?" 1 == 2 evaluates to false: important! Equality is very different from assignment: = is read as "is bound to a value of, == is read as "is equal to?, b = x == y. "the variable b is assigned the result of evaluating"is x equal to y?"" The not equal to operator is !: the ! symbol in many programming languages often means "not" 1 != 2 evaluates to true: b = x != y. "the variable b is assigned a value of evaluating"is x not equal to y?"" Logical type - bool: literal examples: true, false, a bool, short for boolean, can only be one of two values, either or false, the next lesson will focus on operators: Equality and relational precedence & types: these operators have lower precedence than arithmetic operators, thus: