Unit III Talking Points—Boolean/Conditional Expresions

CS 1130 Visual Basic—Fall 2017

Day 09 — Unit III Introduction

Logistics

Unit II Review

The grade book is posted. (Those who haven't sent me a code may wish to do so.) Remember that I am checking for "competency". That means I was able to conclude that you were able to carry out the tasks as specified. There is also a measure of being able to perform in the time allowed—that you are able to use the skill/knowledge.

Please come to office hours or set up an appointment to go over the competency demo. Some of you need to do so to resolve question marks.

Remember, you must "pass" CD II before you can retake later competency demos

Questions? Comments? Wonderings?

Boolean Data & Operators—Conditional Expressions

As I indicated last time, the next topic is conditional expressions (or Boolean expression— capitalized because the name comes from the mathematician George Boole). Boolean data is another kind of data that can have only two values—true or false. (Actually, Boolean variables can be undefined also, which should cause an error.) We use Boolean expressions to determine the state of program data (and, thus, our program). Then, eventually we (our code) will make decisions based on the program state as indicated by the Boolean expression.

Boolean variables or expressions appear in three places—assignment statements, selection/if statements, and repetition/do statements.

This unit focusses on the evaluating and producing Boolean expressions that indicate some program state.   Questions? Comments? Wonderings?

Program State

Data in a program represents the problem we are attempting to solve. At any given point in time, the data values represent the state of the program. Our program will want to manipulate the data (change the program state), and/or take some action depending on the state (If or Do statements). When Boolean data is involved we can think of the situation as asking (and answering) questions of the data. The number and kind of program states (questions we might need to ask) is unlimited. That makes it a little hard to talk about.

To determine whether a particular program state exists, we need to be able to think about the program state in terms of the variables (data) that define problem we are working on, and on "manipulations" of that data. The manipulations are arithmetic operators, numeric functions, and string operators & functions that we have seen in Unit II. And now, we need to become familiar with additional operators—Boolean operators.

Boolean operators

There are two types of Boolean operators:  1) relational operators that compare two values (two numeric values or two string values) and   2) logical operators that combine two (Boolean) values.

Boolean/Conditional Expressions

As with numeric and string data, Boolean data has "expressions"— combinations of literals, variables, operations, functions, and parentheses that produce a single value. Examples for the questions notes above are:

Any questions/wonderings about the material above?     [ Respond to questions/comments. ]  

Unit III Practice/Learning Activity

[ Display and discuss the learning/practice activity. Respond to questions/comments. ]     (When no further questions/discussion, students work on the activity ]  

Day 10— Unit III Work Day

Logistics

The main activities for today are:

Next Time: