Control Flow Statements

Total Page:16

File Type:pdf, Size:1020Kb

Control Flow Statements Control Flow Statements Christopher M. Harden Contents 1 Some more types 2 1.1 Undefined and null . .2 1.2 Booleans . .2 1.2.1 Creating boolean values . .3 1.2.2 Combining boolean values . .4 2 Conditional statements 5 2.1 if statement . .5 2.1.1 Using blocks . .5 2.2 else statement . .6 2.3 Tertiary operator . .7 2.4 switch statement . .8 3 Looping constructs 10 3.1 while loop . 10 3.2 do while loop . 11 3.3 for loop . 11 3.4 Further loop control . 12 4 Try it yourself 13 1 1 Some more types 1.1 Undefined and null The undefined type has only one value, undefined. Similarly, the null type has only one value, null. Since both types have only one value, there are no operators on these types. These types exist to represent the absence of data, and their difference is only in intent. • undefined represents data that is accidentally missing. • null represents data that is intentionally missing. In general, null is to be used over undefined in your scripts. undefined is given to you by the JavaScript interpreter in certain situations, and it is useful to be able to notice these situations when they appear. Listing 1 shows the difference between the two. Listing 1: Undefined and Null 1 var name; 2 // Will say"Hello undefined" 3 a l e r t( "Hello" + name); 4 5 name= prompt( "Do not answer this question" ); 6 // Will say"Hello null" 7 a l e r t( "Hello" + name); 1.2 Booleans The Boolean type has two values, true and false. Booleans can be used to represent conditions such as \is the user signed in", or \is the input valid". If a non-boolean value is used when JavaScript expects a boolean value, JavaScript will perform type coercion. The rules for this type coercion is fairly simple. There are six expressions that convert to false, and all other expressions become true. These six \falsy" values are: • false • null • 0 • undefined • "" • NaN 2 1.2.1 Creating boolean values By far the most common way of obtaining booleans is by performing a com- parison. This allows you to ask questions such as \are these two things equal?" and \which value is larger?". Since = is used to assign to variables, we must use a different symbol to test equality. There are actually two of these, == and ===, called the loose equality operator and the strict equality operator respectively. The difference between the two concerns type coercion. If given two different types to compare, the loose equality operator will attempt to coerce one or both types until they match, whereas the strict equality operator will immediately return false without attempting to coerce. It is preferable to use the strict equality operator whenever possible. However, the loose equality operator will often be seen in legacy code. Listing 2 shows some examples. Listing 2: Using the equality operators 1 5 == 5 ; // true 2 5 === 5 ; // true 3 1 == "1" ; // true, string becomesa number 4 1 === "1" ; // false, two different types 5 null == undefined ; // true, both falsy values 6 null === undefined ; // false, two different types 7 true == "true" ; // false, this coerces weirdly! The unique number NaN has some interesting properties when it comes to equality. NaN is the only value,x, such thatx ==x andx ===x are both false. NaN is returned if Number(x) fails to convertx into a number, which can be used to detect failed conversions. Due to the unique nature of NaN, we can use Number.isNaN(x) to check ifx is NaN more obviously. The equality operators both have equivalent inequality operators, namely != and !==, in loose and strict forms. These operators return the opposite of the corresponding equality operators. For example, if === returns true then !== returns false for the same values. For numbers, we can also check if a value is less than or greater than another value. Unsurprisingly, these are represented by < and >. We also have <= and >= to represent `less than or equal to' and `greater than or equal to'. It is important to remember that = always comes after < or > in these operators. 3 1.2.2 Combining boolean values More complicated tests can be created by combining simpler tests. To do this we need a logical operator. There are three of these: the AND oper- ator represented by &&, the OR operator represented by jj , and the NOT operator represented by !. • x&&y returns true if bothx andy are true, and false otherwise. • x jj y returns true if eitherx andy are true, and false otherwise. • !x returns true ifx is false, and true otherwise. Since ! always returns a boolean value, it is possible to use !!x to convert x into a boolean. For consistency with String() and Number(), there exists a Boolean() that also converts values to boolean values. The AND and OR operators also work on non-boolean values. They coerce values like normal to check the condition; however they are not guar- anteed to return a boolean. Instead they act slightly differently in this case. • x&&y returnsx ifx converts to false, andy otherwise. • x jj y returnsx ifx converts to true, andy otherwise. This is sometimes seen when input is taken from the user, and there exists a default value. For example, if a user refuses to answer a prompt(), you will receive as an answer null if the user clicked Cancel, and "" if the user clicked OK. Since both of these are falsy values, and are the only falsy values prompt() can return, you can assign a default value with code such as in listing 3. Listing 3: Using AND/OR with non-boolean values 1 var name= prompt( "What is your name?" ) j j "unknown person" ; 2 a l e r t( "Hello" + name); Since false &&x and true jj x can be determined without checkingx, JavaScript will not checkx at all. This property is called short-circuit evalua- tion. This is usually just an optimisation used to make your script run faster. However, ifx had any effects other than returning a value, those effects will not occur. For reasons of clarity, avoid such effects whenever possible. 4 2 Conditional statements It is often required to run code only under specific circumstances. For exam- ple, we can convert values into numbers with Number(). If the conversion fails, we get NaN. However, while we can detect a failed conversion, we can- not do anything about it. To do something about it, we need to be able to run code if and only if a conversion fails. 2.1 if statement The if statement is the most common conditional statement. Indeed, all decisions made by your scripts will eventually use an if statement to do it. It takes the form if (condition) statement;, and runs the statement if and only if the condition is true. Listing 4 shows if statements being used to get a person's age, and to adjust the value such that it is always guaranteed to be a number greater than or equal to zero. Listing 4: Using if statements 1 var age= prompt( "How old are you?" ); 2 3 i f (Number.isNaN(age)) age=0; 4 5 i f (age < 0) 6 age= −age; Listing 4 also explicitly demonstrates a property of JavaScript that has previously been left implicit. Note that lines 5 and 6 represent the same if statement. That is because white space is ignored in general. As long as the JavaScript interpreter can understand your script, it cares not for any extra white space you insert. As you write more and more scripts, you should insert white space as you please to make the script easier for you to read. Any style is acceptable as long as you remain consistent throughout a script. 2.1.1 Using blocks Sometimes you cannot express what you need to in a single statement. For example, if you have two numbers,a andb, and you need to make sure thata is the lesser number, then you need to be able to swap the variables. However, you need at least three statements to do this: one to hold the contents ofb so you have a copy, one to eraseb and fill it with the contents ofa, and one to erasea and fill it with the copy you held previously. 5 JavaScript gives you a way to group multiple statements and use it as if it was a single statement. To do this, collect the statements inside f and g. Listing 5 uses a block to perform the swapping procedure mentioned above, after detecting the problem with an if statement. Listing 5: Swapping variables 1 var a= 5; 2 var b= 3; 3 4 i f (a > b) f 5 let tmp=b; 6 b=a; 7 a=b; 8 g Inside a block, the effects of let and const change. Any variables declared by let and const inside a block disappear outside of the block. Additionally, if you declare a variable that is already defined outside the block, that variable will be hidden from you inside the block and restored when you leave the block. Thus we cannot accidentally trample over variables required in other parts of your script. Thus in listing 5, tmp is no longer usable outside of the if statement, and other tmp variables will be left untouched. Of course, since this tmp variable no longer serves a purpose after completing the swap, this is the correct thing to do. It is good practice to keep variables around only as long as you need them, and to never perform `actions at a distance'.
Recommended publications
  • C++ Programming: Program Design Including Data Structures, Fifth Edition
    C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 5: Control Structures II (Repetition) Objectives In this chapter, you will: • Learn about repetition (looping) control structures • Explore how to construct and use count- controlled, sentinel-controlled, flag- controlled, and EOF-controlled repetition structures • Examine break and continue statements • Discover how to form and use nested control structures C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2 Objectives (cont'd.) • Learn how to avoid bugs by avoiding patches • Learn how to debug loops C++ Programming: From Problem Analysis to Program Design, Fifth Edition 3 Why Is Repetition Needed? • Repetition allows you to efficiently use variables • Can input, add, and average multiple numbers using a limited number of variables • For example, to add five numbers: – Declare a variable for each number, input the numbers and add the variables together – Create a loop that reads a number into a variable and adds it to a variable that contains the sum of the numbers C++ Programming: From Problem Analysis to Program Design, Fifth Edition 4 while Looping (Repetition) Structure • The general form of the while statement is: while is a reserved word • Statement can be simple or compound • Expression acts as a decision maker and is usually a logical expression • Statement is called the body of the loop • The parentheses are part of the syntax C++ Programming: From Problem Analysis to Program Design, Fifth Edition 5 while Looping (Repetition)
    [Show full text]
  • Compiler Construction Assignment 3 – Spring 2018
    Compiler Construction Assignment 3 { Spring 2018 Robert van Engelen µc for the JVM µc (micro-C) is a small C-inspired programming language. In this assignment we will implement a compiler in C++ for µc. The compiler compiles µc programs to java class files for execution with the Java virtual machine. To implement the compiler, we can reuse the same concepts in the code-generation parts that were done in programming assignment 1 and reuse parts of the lexical analyzer you implemented in programming assignment 2. We will implement a new parser based on Yacc/Bison. This new parser utilizes translation schemes defined in Yacc grammars to emit Java bytecode. In the next programming assignment (the last assignment following this assignment) we will further extend the capabilities of our µc compiler by adding static semantics such as data types, apply type checking, and implement scoping rules for functions and blocks. Download Download the Pr3.zip file from http://www.cs.fsu.edu/~engelen/courses/COP5621/Pr3.zip. After unzipping you will get the following files Makefile A makefile bytecode.c The bytecode emitter (same as Pr1) bytecode.h The bytecode definitions (same as Pr1) error.c Error reporter global.h Global definitions init.c Symbol table initialization javaclass.c Java class file operations (same as Pr1) javaclass.h Java class file definitions (same as Pr1) mycc.l *) Lex specification mycc.y *) Yacc specification and main program symbol.c *) Symbol table operations test#.uc A number of µc test programs The files marked ∗) are incomplete. For this assignment you are required to complete these files.
    [Show full text]
  • PDF Python 3
    Python for Everybody Exploring Data Using Python 3 Charles R. Severance 5.7. LOOP PATTERNS 61 In Python terms, the variable friends is a list1 of three strings and the for loop goes through the list and executes the body once for each of the three strings in the list resulting in this output: Happy New Year: Joseph Happy New Year: Glenn Happy New Year: Sally Done! Translating this for loop to English is not as direct as the while, but if you think of friends as a set, it goes like this: “Run the statements in the body of the for loop once for each friend in the set named friends.” Looking at the for loop, for and in are reserved Python keywords, and friend and friends are variables. for friend in friends: print('Happy New Year:', friend) In particular, friend is the iteration variable for the for loop. The variable friend changes for each iteration of the loop and controls when the for loop completes. The iteration variable steps successively through the three strings stored in the friends variable. 5.7 Loop patterns Often we use a for or while loop to go through a list of items or the contents of a file and we are looking for something such as the largest or smallest value of the data we scan through. These loops are generally constructed by: • Initializing one or more variables before the loop starts • Performing some computation on each item in the loop body, possibly chang- ing the variables in the body of the loop • Looking at the resulting variables when the loop completes We will use a list of numbers to demonstrate the concepts and construction of these loop patterns.
    [Show full text]
  • 7. Control Flow First?
    Copyright (C) R.A. van Engelen, FSU Department of Computer Science, 2000-2004 Ordering Program Execution: What is Done 7. Control Flow First? Overview Categories for specifying ordering in programming languages: Expressions 1. Sequencing: the execution of statements and evaluation of Evaluation order expressions is usually in the order in which they appear in a Assignments program text Structured and unstructured flow constructs 2. Selection (or alternation): a run-time condition determines the Goto's choice among two or more statements or expressions Sequencing 3. Iteration: a statement is repeated a number of times or until a Selection run-time condition is met Iteration and iterators 4. Procedural abstraction: subroutines encapsulate collections of Recursion statements and subroutine calls can be treated as single Nondeterminacy statements 5. Recursion: subroutines which call themselves directly or indirectly to solve a problem, where the problem is typically defined in terms of simpler versions of itself 6. Concurrency: two or more program fragments executed in parallel, either on separate processors or interleaved on a single processor Note: Study Chapter 6 of the textbook except Section 7. Nondeterminacy: the execution order among alternative 6.6.2. constructs is deliberately left unspecified, indicating that any alternative will lead to a correct result Expression Syntax Expression Evaluation Ordering: Precedence An expression consists of and Associativity An atomic object, e.g. number or variable The use of infix, prefix, and postfix notation leads to ambiguity An operator applied to a collection of operands (or as to what is an operand of what arguments) which are expressions Fortran example: a+b*c**d**e/f Common syntactic forms for operators: The choice among alternative evaluation orders depends on Function call notation, e.g.
    [Show full text]
  • While Statement in C
    While Statement In C EnricoIs Reg alwaysdisheartening deplete or his novel aspects when chagrined luminesced disputatiously, some crayfishes he orbits clump so temporizingly? grindingly. Solid Ring-necked and comose Bennet Brendan tarnishes never tensehalf-and-half his Stuttgart! while Thank you use a counter is a while loop obscures the condition which is evaluated to embed videos in while c program C while loops statement allows to repeatedly run at same recipient of code until a wrap is met while loop is empty most basic loop in C programming while loop. We then hand this variable c in the statement block and represent your value for each. While adultery in C Set of instructions given coil the compiler to night set of statements until condition becomes false is called loops. If it is negative number added to the condition in c language including but in looping structures, but is executed infinite loop! While Loop Definition Example & Results Video & Lesson. While talking in C Know Program. What is the while eternal in C? A while loop around loop continuously and infinitely until the policy inside the parenthesis becomes false money must guard the. C while and dowhile Loop Programiz. Programming While Loop. The widow while redeem in the C language is basically a post tested loop upon the execution of several parts of the statements can be repeated by reckless use children do-while. 43 Loops Applications in C for Engineering Technology. Do it Loop in C Programming with Examples Phptpoint. Statements and display control C Tutorials Cpluspluscom. Do while just in c example program.
    [Show full text]
  • A Survey of Hardware-Based Control Flow Integrity (CFI)
    A survey of Hardware-based Control Flow Integrity (CFI) RUAN DE CLERCQ∗ and INGRID VERBAUWHEDE, KU Leuven Control Flow Integrity (CFI) is a computer security technique that detects runtime attacks by monitoring a program’s branching behavior. This work presents a detailed analysis of the security policies enforced by 21 recent hardware-based CFI architectures. The goal is to evaluate the security, limitations, hardware cost, performance, and practicality of using these policies. We show that many architectures are not suitable for widespread adoption, since they have practical issues, such as relying on accurate control flow model (which is difficult to obtain) or they implement policies which provide only limited security. CCS Concepts: • Security and privacy → Hardware-based security protocols; Information flow control; • General and reference → Surveys and overviews; Additional Key Words and Phrases: control-flow integrity, control-flow hijacking, return oriented programming, shadow stack ACM Reference format: Ruan de Clercq and Ingrid Verbauwhede. YYYY. A survey of Hardware-based Control Flow Integrity (CFI). ACM Comput. Surv. V, N, Article A (January YYYY), 27 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn 1 INTRODUCTION Today, a lot of software is written in memory unsafe languages, such as C and C++, which introduces memory corruption bugs. This makes software vulnerable to attack, since attackers exploit these bugs to make the software misbehave. Modern Operating Systems (OSs) and microprocessors are equipped with security mechanisms to protect against some classes of attacks. However, these mechanisms cannot defend against all attack classes. In particular, Code Reuse Attacks (CRAs), which re-uses pre-existing software for malicious purposes, is an important threat that is difficult to protect against.
    [Show full text]
  • Repetition Structures
    24785_CH06_BRONSON.qrk 11/10/04 9:05 M Page 301 Repetition Structures 6.1 Introduction Goals 6.2 Do While Loops 6.3 Interactive Do While Loops 6.4 For/Next Loops 6.5 Nested Loops 6.6 Exit-Controlled Loops 6.7 Focus on Program Design and Implementation: After-the- Fact Data Validation and Creating Keyboard Shortcuts 6.8 Knowing About: Programming Costs 6.9 Common Programming Errors and Problems 6.10 Chapter Review 24785_CH06_BRONSON.qrk 11/10/04 9:05 M Page 302 302 | Chapter 6: Repetition Structures The applications examined so far have illustrated the programming concepts involved in input, output, assignment, and selection capabilities. By this time you should have gained enough experience to be comfortable with these concepts and the mechanics of implementing them using Visual Basic. However, many problems require a repetition capability, in which the same calculation or sequence of instructions is repeated, over and over, using different sets of data. Examples of such repetition include continual checking of user data entries until an acceptable entry, such as a valid password, is made; counting and accumulating running totals; and recurring acceptance of input data and recalculation of output values that only stop upon entry of a designated value. This chapter explores the different methods that programmers use to construct repeating sections of code and how they can be implemented in Visual Basic. A repeated procedural section of code is commonly called a loop, because after the last statement in the code is executed, the program branches, or loops back to the first statement and starts another repetition.
    [Show full text]
  • Control-Flow Analysis of Functional Programs
    Control-flow analysis of functional programs JAN MIDTGAARD Department of Computer Science, Aarhus University We present a survey of control-flow analysis of functional programs, which has been the subject of extensive investigation throughout the past 30 years. Analyses of the control flow of functional programs have been formulated in multiple settings and have led to many different approximations, starting with the seminal works of Jones, Shivers, and Sestoft. In this paper, we survey control-flow analysis of functional programs by structuring the multitude of formulations and approximations and comparing them. Categories and Subject Descriptors: D.3.2 [Programming Languages]: Language Classifica- tions—Applicative languages; F.3.1 [Logics and Meanings of Programs]: Specifying and Ver- ifying and Reasoning about Programs General Terms: Languages, Theory, Verification Additional Key Words and Phrases: Control-flow analysis, higher-order functions 1. INTRODUCTION Since the introduction of high-level languages and compilers, much work has been devoted to approximating, at compile time, which values the variables of a given program may denote at run time. The problem has been named data-flow analysis or just flow analysis. In a language without higher-order functions, the operator of a function call is apparent from the text of the program: it is a lexically visible identifier and therefore the called function is available at compile time. One can thus base an analysis for such a language on the textual structure of the program, since it determines the exact control flow of the program, e.g., as a flow chart. On the other hand, in a language with higher-order functions, the operator of a function call may not be apparent from the text of the program: it can be the result of a computation and therefore the called function may not be available until run time.
    [Show full text]
  • An Introduction to Programming in Simula
    An Introduction to Programming in Simula Rob Pooley This document, including all parts below hyperlinked directly to it, is copyright Rob Pooley ([email protected]). You are free to use it for your own non-commercial purposes, but may not copy it or reproduce all or part of it without including this paragraph. If you wish to use it for gain in any manner, you should contact Rob Pooley for terms appropriate to that use. Teachers in publicly funded schools, universities and colleges are free to use it in their normal teaching. Anyone, including vendors of commercial products, may include links to it in any documentation they distribute, so long as the link is to this page, not any sub-part. This is an .pdf version of the book originally published by Blackwell Scientific Publications. The copyright of that book also belongs to Rob Pooley. REMARK: This document is reassembled from the HTML version found on the web: https://web.archive.org/web/20040919031218/http://www.macs.hw.ac.uk/~rjp/bookhtml/ Oslo 20. March 2018 Øystein Myhre Andersen Table of Contents Chapter 1 - Begin at the beginning Basics Chapter 2 - And end at the end Syntax and semantics of basic elements Chapter 3 - Type cast actors Basic arithmetic and other simple types Chapter 4 - If only Conditional statements Chapter 5 - Would you mind repeating that? Texts and while loops Chapter 6 - Correct Procedures Building blocks Chapter 7 - File FOR future reference Simple input and output using InFile, OutFile and PrintFile Chapter 8 - Item by Item Item oriented reading and writing and for loops Chapter 9 - Classes as Records Chapter 10 - Make me a list Lists 1 - Arrays and simple linked lists Reference comparison Chapter 11 - Like parent like child Sub-classes and complex Boolean expressions Chapter 12 - A Language with Character Character handling, switches and jumps Chapter 13 - Let Us See what We Can See Inspection and Remote Accessing Chapter 14 - Side by Side Coroutines Chapter 15 - File For Immediate Use Direct and Byte Files Chapter 16 - With All My Worldly Goods..
    [Show full text]
  • Detecting and Escaping Infinite Loops Using Bolt
    Detecting and Escaping Infinite Loops Using Bolt by Michael Kling Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Masters of Engineering in Electical Engineering and Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY February 2012 c Massachusetts Institute of Technology 2012. All rights reserved. Author.............................................................. Department of Electrical Engineering and Computer Science February 1, 2012 Certified by. Martin Rinard Professor Thesis Supervisor Accepted by . Prof. Dennis M. Freeman Chairman, Masters of Engineering Thesis Committee 2 Detecting and Escaping Infinite Loops Using Bolt by Michael Kling Submitted to the Department of Electrical Engineering and Computer Science on February 1, 2012, in partial fulfillment of the requirements for the degree of Masters of Engineering in Electical Engineering and Computer Science Abstract In this thesis we present Bolt, a novel system for escaping infinite loops. If a user suspects that an executing program is stuck in an infinite loop, the user can use the Bolt user interface, which attaches to the running process and determines if the program is executing in an infinite loop. If that is the case, the user can direct the interface to automatically explore multiple strategies to escape the infinite loop, restore the responsiveness of the program, and recover useful output. Bolt operates on stripped x86 and x64 binaries, analyzes both single-thread and multi-threaded programs, dynamically attaches to the program as-needed, dynami- cally detects the loops in a program and creates program state checkpoints to enable exploration of different escape strategies. This makes it possible for Bolt to detect and escape infinite loops in off-the-shelf software, without available source code, or overhead in standard production use.
    [Show full text]
  • 6Up with Notes
    Notes CSCE150A Computer Science & Engineering 150A Problem Solving Using Computers Lecture 05 - Loops Stephen Scott (Adapted from Christopher M. Bourke) Fall 2009 1 / 1 [email protected] Chapter 5 CSCE150A 5.1 Repetition in Programs 5.2 Counting Loops and the While Statement 5.3 Computing a Sum or a Product in a Loop 5.4 The for Statement 5.5 Conditional Loops 5.6 Loop Design 5.7 Nested Loops 5.8 Do While Statement and Flag-Controlled Loops 5.10 How to Debug and Test 5.11 Common Programming Errors 2 / 1 Repetition in Programs CSCE150A Just as the ability to make decisions (if-else selection statements) is an important programming tool, so too is the ability to specify the repetition of a group of operations. When solving a general problem, it is sometimes helpful to write a solution to a specific case. Once this is done, ask yourself: Were there any steps that I repeated? If so, which ones? Do I know how many times I will have to repeat the steps? If not, how did I know how long to keep repeating the steps? 3 / 1 Notes Counting Loops CSCE150A A counter-controlled loop (or counting loop) is a loop whose repetition is managed by a loop control variable whose value represents a count. Also called a while loop. 1 Set counter to an initial value of 0 2 while counter < someF inalV alue do 3 Block of program code 4 Increase counter by 1 5 end Algorithm 1: Counter-Controlled Loop 4 / 1 The C While Loop CSCE150A This while loop computes and displays the gross pay for seven employees.
    [Show full text]
  • CS 161, Lecture 8: Error Handling and Functions – 29 January 2018 Revisit Error Handling
    CS 161, Lecture 8: Error Handling and Functions – 29 January 2018 Revisit Error Handling • Prevent our program from crashing • Reasons programs will crash or have issues: • Syntax Error – prevents compilation, the programmer caused this by mistyping or breaking language rules • Logic Errors – the code does not perform as expected because the underlying logic is incorrect such as off by one, iterating in the wrong direction, having conditions which will never end or be met, etc. • Runtime Errors – program stops running due to segmentation fault or infinite loop potentially caused by trying to access memory that is not allocated, bad user input that was not handled, etc. check_length • The end of a string is determined by the invisible null character ‘\0’ • while the character in the string is not null, keep counting Assignment 3 Notes • Allowed functions: • From <string>: .length(), getline(), [], += • From <cmath>: pow() • Typecasting allowed only if the character being converted fits the stated criterion (i.e. character was confirmed as an int, letter, etc.) • ASCII Chart should be used heavily http://www.asciitable.com/ Debugging Side Bar • Read compiler messages when you have a syntax error • If you suspect a logic error -> print everything! • Allows you to track the values stored in your variables, especially in loops and changing scopes • Gives you a sense of what is executing when in your program Decomposition • Divide problem into subtasks • Procedural Decomposition: get ready in the morning, cooking, etc. • Incremental Programming:
    [Show full text]