Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Type Called bool  Bool has only two possible values: True and False.

Similar presentations


Presentation on theme: " Type Called bool  Bool has only two possible values: True and False."— Presentation transcript:

1

2  Type Called bool  Bool has only two possible values: True and False

3  Three Basic operators: and, or, not  Not > and > or  Not is a unary operator, applied to one value  negation of an expression  And and or are binary operators -  How do they work let us see in the shell??

4  Doing comparisons using the following binary relational operators: SymbolOperation >Greater than <Less than >=Greater than or equal to <=Less than or equal to ==Equal to !=Not equal to DO NOT CONFUSE = for assignment with == for equality!

5  Arithmetic operators have a higher precedence than relational operators.  + and / are evaluated before  Relational operators have higher precedence than Boolean operators  Comparisons evaluated before and, or, not  Chain Rules when they seem natural in mathematics!!

6  Characters in strings are represented by integers, this encoding is called ASCII (American Standard Code for Information Interchange)  Example: A = 65, space = 32, lowercase z = 122  Used to compare strings in alphabetical order  If character from one string is greater than character from other  first string is grater than second as in z > A because (z = 122) > (A = 65)  Lexicographical comparisons: check whether one string inside another one

7 If >: > Condition  Expression Block  Statements indented to be executed if condition is true To add more cases, use elif (else if) or else If >: > Elif >: > Else: >

8

9

10

11


Download ppt " Type Called bool  Bool has only two possible values: True and False."

Similar presentations


Ads by Google