Comments give notes to the reader to explain what your code is doing. Two types of comments that can utilized are preconditions and postconditions. Preconditions are assumptions we make about what is true before a function is called in our program. Postconditions are what should be true after a function is called in our program.
Students will be able to…
* Explain the preconditions and postconditions of a function
* Create clear and readable comments in their code that help the reader understand the code
* Explain the purpose of comments
Introducing Super Karel! Since commands like turnRight()
and turnAround()
are so commonly used, we shouldn’t have to define them in every single program. They should come prepackaged with the Karel library. This is where SuperKarel comes in. SuperKarel is just like Karel, except SuperKarel already knows how to turnRight and turnAround, so we don’t have to define those methods ourselves anymore.
Students will be able to…
* Write programs that use SuperKarel instead of Karel
* Utilize the new toolbox of commands that SuperKarel provides over Karel
* Read documentation to understand how to use a library (SuperKarel is an example of this)
This lesson teaches students how to use for loops in their programs. The for loop allows you to repeat a specific part of code a fixed number of times.
We write for loops like this:
for(var i = 0; i < 4; i++)
{
// Code to be repeated 4 times
}
Students will be able to…
* Create for loops to repeat code a fixed number of times
* Explain when a for loop would be a useful tool
* Utilize for loops to write programs that would be difficult / impossible without loops
This lesson gives students more practice creating and debugging for loops. The for loop allows you to repeat a specific part of code a fixed number of times.
Students will be able to…
* Create for loops to repeat code a fixed number of times
* Debug programs with incorrect for loop usage
* Explain when a for loop should be used