The Linux Command Line Chapter 29

Slides:



Advertisements
Similar presentations
CHAPTER 5: LOOP STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Advertisements

Executes a statement or statements for a number of times – iteration. Syntax for(initialize; test; increment) { // statements to be executed } Initial.
MatLab – Palm Chapter 4, Part 3 For and While Loops
COMP 14 Introduction to Programming Miguel A. Otaduy May 21, 2004.
Iteration This week we will learn how to use iteration in C++ Iteration is the repetition of a statement or block of statements in a program. C++ has three.
Chapter 5: Control Structures II (Repetition)
1 MATERI PENDUKUNG JUMP Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Loop Statements (Iteration). Iteration  A portion of a program that repeats a statement or group of statements is called a loop.  Each repetition of.
Flow of Control Loops – Chapter 3.2. Java Loop Statements: Outline the while Statement the do-while Statement the for Statement.
Agenda Control Flow Statements Purpose test statement if / elif / else Statements for loops while vs. until statements case statement break vs. continue.
Python Control Flow statements There are three control flow statements in Python - if, for and while.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
1 4.8The do/while Repetition Structure The do/while repetition structure –Similar to the while structure –Condition for repetition tested after the body.
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
CPS120 Introduction to Computer Science Iteration (Looping)
Chapter 7 Additional Control Structures. 2 2 void GetYesOrNo (/* out */ char& response) // Inputs a character from the user // Postcondition: response.
Chapter 5 Loops. Overview u Loop Statement Syntax  Loop Statement Structure: while, for, do-while u Count-Controlled Loops u Nested Loops u Loop Testing.
Lecture 4 Looping. Building on the foundation Now that we know a little about  cout  cin  math operators  boolean operators  making decisions using.
Chapter 8 Iteration Dept of Computer Engineering Khon Kaen University.
L OO P S While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 ‏ Control Structures.
CSE 425: Control Flow I Categories of Control Flow Constructs Sequencing –order of expressions and statements Selection –if, else, switch Iteration –loops.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 9 & 10 Repetition Statements.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
CPS120 Introduction to Computer Science Iteration (Looping)
Chapter 8: MuPAD Programming I Conditional Control and Loops MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
Repetition Repetition allows you to repeat an operation or a series of operations many times. This is called looping and is one of the basic structured.
LECTURE # 8 : REPETITION STATEMENTS By Mr. Ali Edan.
Chapter 7: Repetition Structure (Loop) Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills.
Loop Control อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 8.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
Do-more Technical Training Instruction Set (Program-Looping)
Fundamentals of PL/SQL part 2 (Basics)
Chapter 6: Loops.
Chapter 4 Repetition Statements (loops)
Repetition Structures Chapter 9
Warm-up Program Use the same method as your first fortune cookie project and write a program that reads in a string from the user and, at random, will.
Control Structures II (Repetition)
The Linux Command Line Chapter 14
CiS 260: App Dev I Chapter 4: Control Structures II.
Chapter 2.2 Control Structures (Iteration)
Agenda Control Flow Statements Purpose test statement
The Linux Command Line Chapter 2
The Linux Command Line Chapter 10
The Linux Command Line Chapter 7
The Linux Command Line Chapter 18
The Linux Command Line Chapter 27
The Linux Command Line Chapter 3
The Linux Command Line Chapter 26
The Linux Command Line Chapter 28
The Linux Command Line Chapter 9
Chapter 2.2 Control Structures (Iteration)
The Linux Command Line Chapter 17
The Linux Command Line Chapter 4
The Linux Command Line Chapter 25
It’s Time for a Break!!!.
ECE 103 Engineering Programming Chapter 20 Change in Flow of Control
The Linux Command Line Chapter 14
Introduction to Computer Science
Flow of Control.
CSCI 1100/1202 February 6, 2002.
break & continue Statements
Review The Unix Shells Graham Glass and King Ables,
The Linux Command Line Chapter 3
The Linux Command Line Chapter 4
The Linux Command Line Chapter 26
The Linux Command Line Chapter 27
Presentation transcript:

The Linux Command Line Chapter 29 Flow Control: Looping With while / until Prepared by Dr. Reyes, New York City College of Technology

while Loop while – a command that evaluates the exit status of a list of commands, and executes the commands inside the loop as long as the exit status is zero. Stops otherwise. Syntax: while commands; do commands done

while Loop Example

Breaking Out Of A Loop break – A command that immediately terminates a loop, and makes a program control resume with the next statement following the loop. continue – A command that causes the remainder of the loop to be skipped, and program control resumes with the next iteration of the loop. These commands should seldom be used.

The until Command until - A command similar to the while, except that instead of exiting a loop when a nonzero exit status is encountered, it does the opposite. An until loop continues until it receives a zero exit status Syntax: until commands; do commands done

until Command Example