Pascal Programming: Week 2 Notes Handling I/O and Error Checking pg. 60-65 Differences between Read and Readln; Write and Writeln; Wrong data type input: examples - commas not allowed real versus integer input mixed alpha-numeric Exception Handling Operator Precedence in Pascal First: NOT Second: * / DIV MOD AND Third: + - OR Fourth: <= = >= > < <> IN Operators in the same group are evaluated in left-to-right order Parenthesis can be used to establish order Looping Structures If Then Else Statement : IF THEN BEGIN ; END ELSE ; END; While Do Statement : WHILE DO BEGIN ; ; END; Repeat Until Statement : REPEAT ; ; UNTIL ; Programming Principles, Logical Program Flow Analyze Problem: Write out the basic algorithm Design the Structure: Flow chart the logical sequence of steps Code and Test Proper Documentation and Coding for Iterative Structures pg. 259-265 DOCUMENT: Assertions: Pre-conditions, Post-Conditions Loop Invariant Loop Design: 1.) The Body 2.) The Initializing Statement 3.) The Exit Criteria Common Iterative Errors 1.) Uninitialized variables 2.) Infinite loops 3.) Off by one 4.) No or unattained exit criteria