COSC 236 Study Guide - Midterm Guide: Data Validation, For Loop, Increment And Decrement Operators
Document Summary
Computer science 236 exam 2 study guide (loops, files, and methods) A structure that allows you to repeat instructions more than once. The while loop: use this for input validation. Initialization, condition, and update (goes in a circle/infinite loop) Input validation is the process of ensuring that user input is valid: *keeps asking the user for information until the input is correct with the information being asked, checks information first and then executes statements. The do-while loop: a post-test loop. It will execute the loop prior to testing the condition: executes statements then check the condition, statements boolean expression (true or false) true(go back to statements)/ false (other code, sometimes called a do loop. A pre-test loop: allows the programmer to initialize a control variable, test a condition, and modify the control variable all in one line of code, combines initialization, condition, and statement all in one sentence, form: