Skip to main content

CS101: Introduction to Computer Science I

Page path
  • Home /
  • Courses /
  • Course Catalog /
  • Computer Science /
  • CS101: Introduction to Computer Science I /
  • Unit 5: Control Structures /
  • 5.5: The 'for' Loop
Back to 'Unit 5: Control Structures'
  • 5.5: The 'for' Loop

    • Central Connecticut State University: Bradley Kjell's "Introduction to Computer Science Using Java, Chapter 41: The Fantastic For Statement" >

      Please read this chapter. This chapter discusses for loop. This loop is more compact than the while and do loops and automatically updates the loop counter at the end of each iteration.

    •  Quiz on For Loops

      Attempt this ungraded quiz.

    • Central Connecticut State University: Bradley Kjell's "Introduction to Computer Science Using Java, Chapter 42: More about the For Statement" >

      Please read this chapter. Make sure to click on the arrow buttons to navigate to each webpage. You may also click on the sound icon at the top of the webpage to listen to the MP3. This chapter discusses the for loop in greater detail as well as the scope of variables in the for loop.

    •  Quiz on Further For Loops

      Attempt this ungraded quiz.

    • Khan Academy: "For Loops in Python" Page

      Please watch the 11-minute lecture. This lecture explains loops by applying them to a simple application, manipulating lists. Unlike the while loop, the for loop does not require a statement in the body of the loop that updates the control variable. Please note that the for loop is explained using Python programming language.

    • Khan Academy: "Writing a Simple Factorial Program", "Stepping through the Factorial Program", and "Flowchart for the Factorial Program" Page

      Watch these lectures. The first lecture uses a for loop to calculate the factorial of a natural number greater than or equal to 0. Remember to focus on the design or algorithm of the program and the semantics of the program statements.

      In the second, note how Khan verifies the program by stepping through it. In the previous video, he also ran it several times to check it out.

      In the third lecture, Khan documents the design of the factorial program by flowcharting it; this is the design of the program, which logically is done before writing the program.


Navigation

Art History
Biology
Business Administration
Chemistry
Communication
Economics
English
History
Mathematics

Creative Commons License
© Saylor Academy 2010-2018 except as otherwise noted. Excluding course final exams, content authored by Saylor Academy is available under a Creative Commons Attribution 3.0 Unported license. Third-party materials are the copyright of their respective owners and shared under various licenses. See www.saylor.org/open/licensinginformation for detailed licensing information.

Saylor Academy and Saylor.org® are trade names of the Constitution Foundation, a 501(c)(3) organization through which our educational activities are conducted.

Terms of Use | Privacy Policy