Ask Question

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.

+3
Answers (1)
  1. 26 April, 01:14
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers