{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Class 6

# Class 6 - Flow Control Matthew Hashim Click to edit Master...

This preview shows pages 1–9. Sign up to view the full content.

12/4/09 Click to edit Master subtitle style Flow Control Matthew Hashim 9/10/2009 11

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MGMT 290D 12/4/09 Goals n Use the Boolean type and its basic operations. n Use the if statement to perform some statements while skipping others. 22
MGMT 290D 12/4/09 Flow Control n Flow: sequence of steps for performing a user story n Flow control statement: structure for managing flow n Flow control statements used in previous chapters ¨ doInOrder : produces a sequential execution ¨ doTogether : produces a parallel execution n Control statements introduced in the current chapter ¨ if : directs program flow along one of two paths ¨ for : directs flow into a fixed number of loops ¨ while : directs flow into an arbitrary number of loops 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MGMT 290D 12/4/09 Flow Control (continued) 44
MGMT 290D 12/4/09 The Boolean Type n A basic Alice type used to define Boolean variables n A Boolean variable holds a value of true or false n Other basic types: Number and Object n Condition (Boolean expression) ¨ Produces a value of true or false ¨ Basis for decision-making in programs 55

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MGMT 290D 12/4/09 Boolean Functions n Return a value of true or false n Can act as a condition in an if or while statement n Many refer to an object’s bounding box n Example: obj .isBehind( obj2 ) ¨ true , if obj ’s position is beyond obj2 ’s rear edge ¨ false , otherwise 66
MGMT 290D 12/4/09 Boolean Variables n Used to store a value of true or false n Can be used in condition for if or while statement n How to create a Boolean variable ¨ Click create new variable (or parameter ) button ¨ Specify Boolean as variable (or parameter) type 77

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MGMT 290D 12/4/09 Relational Operators n Produce true or false values
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern