Ask Question
5 September, 17:33

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.

+4
Answers (1)
  1. 5 September, 20:53
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers