Karel's Built in Commands
Writing a function is like teaching karel a new word.
Naming Functions: You can name your functions whatever you want, but
you can't have spaces in the function name.
Remember that commands in functions must be indented one level
You call a function to tell the computer to actually carry out the new command.
Remember that commands in conditional statements must be indented one level.
Don't forget the
()
at the end!
Remember that commands in a loop statement must be indented one level.
Example of while loops
Example of for loops
You can have multiple statements or function calls in a for loop.
Use for-loops when you want to repeat something a fixed number of times.
Use while-loops when you want to repeat something as long as a condition is true.