itec 109 lecture 11 while loops. while loops review choices –1 st –2 nd to ?th –last what...

Post on 18-Jan-2016

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ITEC 109

Lecture 11While loops

while loops

Review

• Choices– 1st

– 2nd to ?th– Last

• What happens if you only use ifs?• Can you have just an else by itself?• Homework ?s– iterate + if / else if

while loops

Objectives

• Exam on Tuesday– True / False– Short Answer–Write a simple program– Tell me what a program does

• Learn the last intro concept–While loops

while loops

Problem

• Need to repeat statement(s)• Don’t know the # until program runs

while loops

Solution

• Use boolean variables or operations• while (boolean) do X statements

go = true;while (go):

StatementsSome statement that sets go to be false

top related