• Unit 2: Structuring Program Code

    This unit focuses on implementing simple control structures. First, we will learn how to use conditional and iteration structures to make decisions and to repeat code. We will then discuss how to use debugging tools to test and troubleshoot these structures. We will also explore how to break our code into smaller, more manageable pieces by putting certain common pieces into functions. We will also discus scope, as well as passing variables by value and by reference. Finally, we explore a special type of class, the string, which has some special functions that allow us to manipulate text. By introducing classes and how they are used here, we will be ready to tackle object-oriented programming in the next unit.

    Completing this unit should take you approximately 8 hours.

    • 2.1: Conditional and Iteration Structures

    • 2.2: Testing and Debugging

    • 2.3: The Scope of Variables in a Simple Function

    • 2.4: Arguments Passed by Value and by Reference in a Simple Function

    • 2.5: Functions of the String Class

    • Unit 2 Exercises