Ask Question
28 January, 03:56

It is said that functions with parameters generalize the behavior of a more specific command and allow programmers to use functions instead of duplicated code. explain what this means to you using the difference between turnleft () and turnleft (angle) as an example.

+5
Answers (1)
  1. 28 January, 07:02
    0
    Yes, it is true that functions with parameters generalize the behavior of a more specific command. In the given example, using just the turnleft () function is a specific command. It tells the turtle to move by the default angle of 90 degrees. However, if we use turnleft (angle), specifying the angle we want the turtle to turn by, then we are generalizing the behavior of the turnleft function by letting it turn by the angle that we choose, and not what is already fixed. Moreover, instead of having to give separate instructions to the computer to make the turtle move left each time by different angles, the function gives us the flexibility to just call it whenever we need to turn left and specify the angle we need the turtle to turn by, hence avoiding repetition.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “It is said that functions with parameters generalize the behavior of a more specific command and allow programmers to use functions instead ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers