Advertisements
Advertisements
Question
When the same method has to be called repeatedly with different values, the method call is placed inside a ______ (loop/conditions).
Fill in the Blanks
Advertisements
Solution
When the same method has to be called repeatedly with different values, the method call is placed inside a loop.
Explanation:
A loop (like a for or while loop) is used to repeat a block of code multiple times. Placing a method call inside a loop allows you to run it repeatedly with a new value during each turn, whereas conditions (if-else) only execute a piece of code once.
shaalaa.com
Is there an error in this question or solution?
Chapter 3: User-Defined Methods - Exercises [Page 91]
