Computer Science, asked by starshraddha7411, 1 year ago

A programmer writes a code snippet in which set of the three lines occurs 10 times in different pathway program what program concept should be used to shorten the code length

Answers

Answered by phillipinestest
20

The programming concept that the programmer should use here is modularity or looping.

Depending upon the occurrence of those three lines, a programmer has to use either of the two. If the set of lines are occurring consequently, then loops must be employed.

However, if the set of lines are being used at different points in the program, then the developer must employ modularity, which means, dividing the code into modules (functions).

Here, the developer should enclose the set of 3 lines in a function and then call it on the points in the program where those three lines are required.

Answered by mindfulmaisel
12

"The programming concept that the programmer should use here is modularity or looping.

Depending upon the occurrence of those three lines, a programmer has to use either of the two. If the set of lines are occurring consequently, then loops must be employed. However, if the set of lines are being used at different points in the program, then the developer must employ modularity, which means, dividing the code into modules (functions).

Here, the developer should enclose the set of 3 lines in a function and then call it on the points in the program where those three lines are required."

Similar questions