GCSE Computing:: While Loops

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

Chapter 2.5 Modula 2 Control Instructions. Modula 2 Control Statements Selection statements –BOOLEAN Selector : IF statement –Ordinal Selector : CASE.
Chapter 6: The Repetition Structure
CS0004: Introduction to Programming Repetition – Do Loops.
Loops Counting down from N to 1 in assembly we used JUMP statements to repeat previous instructions thus looping READ LOOP: WRITE SUB decrement JPOSLOOP.
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
Handling Errors Introduction to Computing Science and Programming I.
1 Lab Session-6 CSIT-121 Spring 2005 Structured Choice The do~While Loop Lab Exercises.
Data Model Examples USER SPECIFICATIONS.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
COMP 1001: Introduction to Computers for Arts and Social Sciences Programming in Scratch Monday, May 16, 2011.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Mastery Objective: Students will understand how to use while loops in computer programming.
The Wait-Until-Event pattern Has it happened  Yes, it happened!
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops.
Count and add list of numbers From user input and from file.
End of unit assessment Challenge 1 & 2. Course summary So far in this course you have learnt about and used: Syntax Output to screen (PRINT) Variables.
CW-V1 SDD 0901 Principals of Software Design and Development Loops Starter: Water JugsWater Jugs.
Conditional Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Designing While Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Hints on debugging
Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors in transcription or understanding. If there.
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
Controlling Program Flow with Looping Structures
Welcome. Click to Get Started.. Thanks for visiting the KYTC One Stop Shop… Help us help you. Let us know you’re here by signing in using our kiosks.
GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.
Fourth Quarter.  Involves loops or cycles ◦ Loops: means that a process may be repeated as long as certain condition remains true or remains false. ◦
BO65: PROGRAMMING ITERATION 1. Starter  Write down what you think the code below outputs on screen: Dim intCounter as integer intCounter = 0 Do while.
National Diploma Unit 4 Introduction to Software Development Data Structures – Loops and selection.
Loop Blocks Chapter 6 Part A. Program Blocks 1.Actions- commands, messages, methods 2.Branches- decisions to be made 3.Loops- actions to be repeated.
Microsoft® Small Basic Conditions and Loops Estimated time to complete this lesson: 2 hours.
Repetition In today’s lesson we will look at: why you would want to repeat things in a program different ways of repeating things creating loops in Just.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Chapter 6 Controlling Program Flow with Looping Structures.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC530 Data Structures - LOOP 7/9/20161.
FOP: While Loops.
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
What are the Steps to Fix Error Code 36 in Brother Printer.
While Loops in Python.
Lecture 07 More Repetition Richard Gesick.
Computer Science 101 While Statement.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Standard Algorithms Input validation Finding the minimum
Introduction to pseudocode
Exception Handling.
Repetition Structures
Chapter (3) - Looping Questions.
Higher Computing Using Loops.
For Wednesday No new reading No quiz.
Text / Serial / Sequential Files
3.1 Iteration Loops For … To … Next 18/01/2019.
Flowcharts and Pseudo Code
A LESSON IN LOOPING What is a loop?
DO IT NOW i = 1 total = 0 REPEAT total = total + round(i) i = i + 1
Introduction to Computer Science
Repetition Statements (Loops) - 2
Basic Mr. Husch.
DO IT NOW a = 1 totalStudents = 0 REPEAT
GCSE Computing:: Iteration (For Loops)
While Loops in Python.
File Handling.
How to allow the program to know when to stop a loop.
Iteration – While Loops
GCSE Computing.
Physician Mailing Lists
Presentation transcript:

GCSE Computing:: While Loops

While Loops: Why we need them While loops will repeat something until the user does something that the program allows; The following would be good reasons for using a While Loop: You want to stop the user from entering a value below 0 For example when pricing items; You want to do something until the time runs out For example you want to keep a count of the number of customers entering your shop until closing time; You want to continue running your program until there is an error For example you want to keep printing until the ink runs out

While Loops: In practice The following code asks the user to enter their name, if no name is entered then it will keep requesting until something is entered: Dim sName sName = Inputbox (“Please enter your name”) While sName = “” Wend The following code will run the procedure count_customers continuously until the shop closes: Dim tTime tTime = Now() While tTime < “17:00” count_customers()