The correct answer is "All of the above."
Functions in Karel programs (as well as in programming in general) serve several important purposes, including:
-
Break down our program into smaller parts: Functions allow us to divide complex tasks into manageable pieces, making it easier to develop and understand the program.
-
Avoid repeating code: By using functions, you can reuse code instead of writing the same logic multiple times, which makes the program more efficient and reduces the chances of errors.
-
Make our program more readable: Functions can help improve the readability of code by giving descriptive names to blocks of code, conveying their purpose and making it easier for others (or ourselves) to understand what the program does.
Thus, all the reasons listed contribute to the advantages of using functions in Karel programs.