Note the rights settings.

Slides:



Advertisements
Similar presentations
Introduction to Flowcharting
Advertisements

Introduction to Flowcharting
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
Computer programming Lecture 3. Lecture 3: Outline Program Looping [Kochan – chap.5] –The for Statement –Relational Operators –Nested for Loops –Increment.
Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition.
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
An Object-Oriented Approach to Programming Logic and Design Chapter 6 Looping.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Outlines Chapter 3 –Chapter 3 – Loops & Revision –Loops while do … while – revision 1.
Logic Structure - focus on looping Please use speaker notes for additional information!
Mastery Objective: Students will understand how to use while loops in computer programming.
© 2004 Pearson Addison-Wesley. All rights reserved February 20, 2006 ‘do’ and ‘for’ loops ComS 207: Programming I (in Java) Iowa State University, SPRING.
CONTROLLING PROGRAM FLOW
New Tools And Workshop Mod & For Loops. Modulo Calculates the remainder (remember long division?) % Examples: 7 % 3 10 % 2 2 % 3 evaluates to 1 evaluates.
Chapter 7 LOOPING OPERATIONS: ITERATION. Chapter 7 The Flow of the while Loop.
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
9-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
Iteration While / until/ for loop. While/ Do-while loops Iteration continues until condition is false: 3 important points to remember: 1.Initialise condition.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
JavaScript Loops Please use speaker notes for additional information!
Introduction to ASP.NET Please use speaker notes for additional information!
1 Chapter 9. To familiarize you with  Simple PERFORM  How PERFORM statements are used for iteration  Options available with PERFORM 2.
CS 100 Introduction to Computing Seminar October 7, 2015.
ITERATIVE STATEMENTS. Definition Iterative statements (loops) allow a set of instruction to be executed or performed several until condition are met.
Pascal Programming Iteration (looping) Carl Smith National Certificate Unit 4.
Using Loops. Goals Understand how to create while loops in JavaScript. Understand how to create do/while loops in JavaScript. Understand how to create.
Review while loops Control variables Example Infinite loop
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding the Three Basic Structures Structure: a basic unit of programming logic Any program.
2 Chapter 21 Understanding Structure Programming Logic and Design, Second Edition, Comprehensive 2.
Structured Programming The Basics. Control structures They control the order of execution What order statements will be done in, or whether they will.
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
1 Introduction to Flowcharting Computer Science Principles ASFA.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
This is a while loop. The code is done while the condition is true. The code that is done is enclosed in { }. Note that this program has three parts: Housekeeping.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
Flowchart Symbols Terminal Process Input/ Output Decision
Repetition Structures Chapter 9
CS161 Introduction to Computer Science
PROGRAM CONTROL STRUCTURE
CS1371 Introduction to Computing for Engineers
Introduction to Flowcharting
Web Programming– UFCFB Lecture 16
Loops The loop blocks you've used in Scratch can all be recreated in C! Loops allow for the repetition of code until a condition is met. There are three.
Arrays, For loop While loop Do while loop
While loops.
We are starting to program with JavaScript
Java Programming Loops
Understanding the Three Basic Structures
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Module 4 Loops.
the captured notes and redid - hopefully it all works.
We are starting JavaScript. Here are a set of examples
Searching an Array or Table
Programs. at the code at the site..
Flowcharts and Pseudo Code
A LESSON IN LOOPING What is a loop?
Java Programming Loops
Introduction to Flowcharting
‘do’ and ‘for’ loops October 1, 2007 ComS 207: Programming I (in Java)
Review of Previous Lesson
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Wrapup which is the document write that says the end.
‘do’ and ‘for’ loops October 2, 2006 ComS 207: Programming I (in Java)
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

Note the rights settings.

This means that execution happens once and then checking is done to see if the loop should be executed again.

I have changed the initial value of $ct to 5 before entering the loop.

The setting of $ct to 5 means the loop is done once, ct is incremented to 6 and the loop terminates. This would also work if I had set $ct to 4 initially since the increment happens before the test.

This while loop tests before entering the loop This while loop tests before entering the loop. If the condition is not met, processing never enters the loop.

SInce I started $ct at 5, the test with the while says $ct is not less than 5 so the loop is not entered and no math facts are printed.

The while loop checks what keeps you in the loop and the until checks what gets you out of the loop.

The second loop, the until, has $ct set to 6 prior to entering The second loop, the until, has $ct set to 6 prior to entering. The check finds that $ct is greater than 5 so the loop is not entered.

Remember, programming language must support sequence, decisions, and iteration to be languages. no else.

Note that I hardcoded values into the code.

Took out the { }

settings.

NN Here YY gets need, YN gets not need and N gets not need. Note that with N to the $dept=A question, I do not need to ask the second question. =.

Now I am asking the two questions separately and I have different processing for them all. Note the use of { }.

Note that when I change the if test to "A" to an = sign it does not work - actually the = does an assignment rather than a calculation.

assignment.

Since there are different messages or processing, I cannot combine.

With an OR you need only one so YY, YN and NN will be processed

can change the order of operation with parenthesis.