{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
12/4/09 Click to edit Master subtitle style Flow Control Matthew Hashim 9/10/2009 11
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
MGMT 290D 12/4/09 Flow Control (continued) 44
Image of page 4
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
Image of page 5

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

View Full Document Right Arrow Icon
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
Image of page 6
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
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern