# ALEX Classroom Resource

## Computer Science Fundamentals Unit 5 Course D Lesson 11: While Loops in Farmer (2018)

Classroom Resource Information

Title:

Computer Science Fundamentals Unit 5 Course D Lesson 11: While Loops in Farmer (2018)

URL:

https://curriculum.code.org/csf-18/coursed/11/

Content Source:

Code.org
Type: Lesson/Unit Plan

Overview:

By the time students reach this lesson, they should already have plenty of practice using `repeat `loops, so now it's time to mix things up.

While loops are loops that continue to repeat commands while a condition is met. `While` loops are used when the programmer doesn't know the exact number of times commands need to be repeated but does know what condition needs to be true in order for the loop to continue repeating. For example, students will be working to fill holes and dig dirt in Farmer. They will not know the size of the holes or the height of the mountains of dirt, but the students will know they need to keep filling the holes and digging the dirt as long as the ground is not flat.

As your students continue to deepen their knowledge of loops, they will come across problems where a command needs to be repeated, but it is unknown how many times it needs to be repeated. This is where `while` loops come in. In today's lesson, students will develop a beginner's understanding of condition-based loops and also expand their knowledge of loops in general.

Students will be able to:
- distinguish between loops that repeat a fixed number of times and loops that repeat as long as a condition is true.
- use a while loop to create programs that can solve problems with unknown values.

Note: You will need to create a free account on code.org before you can view this resource.

Content Standard(s):