COSC 1P02 Lecture Notes - Lecture 2: Turtle Graphics, Cosc, Virtual Machine
Document Summary
Originally for consumer electronics (i. e. microwave ovens, refrigerator, televisions, etc. ) T u r t l e has a position and direction and travels a distance. T u r t l e represents a turtle: can move with pen down (draw, can change direction. Loops are a way to repeat statements of code within a program. Ex) for (int i = 0; l < 4; l ++) Creating an integer named l and initializing it with the value of 0. Then stating its limit; the for loop will end once the variable l hits the value 4. However, the loop will end before the value is 4 because it is not inclusive. The increment is 1 due to the double plus sign. While loop will run indefinitely until the condition is not true. Creation of a boolean value (true or false) and it will run until the variable is declared as false. Inner loop done completely each time through outer loop.