Ask Question

There is no hard-and-fast rule as to which is better, but what do you think? What kinds of circumstances would lead you to writing a function versus using a loop?

+2
Answers (1)
  1. 28 July, 06:01
    0
    Functions

    The piece of code that is used to perform the same operation at multiple places with different parameters.

    Loops

    The piece of code that is used to perform a task multiple times and continue until the loop ends.

    Explanation

    Both of these have different kind of circumstances to apply. For example.

    Function can perform a specific operation whenever we call. but when we use loop it will perform same task at multiple times at same place. Functions can be called at different places to perform operations multiple times but once loop called it cannot complete the operations until loop completed. Each time when we call the function we can change the values but in loop in iteration we cannot change the value of any variable until loop ends.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “There is no hard-and-fast rule as to which is better, but what do you think? What kinds of circumstances would lead you to writing a ...” 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