devxlogo

In-Line Code

In-Line Code

Calling a function or procedure incurs some overhead. If you have atwo-line function that is called from only three places, you might considerputting those three lines in the functions themselves and not make thema function. This can save some processing time. This could lead to somefuture maintenance problems, however. Here are two options.

 Option 1: For iLoop = 1 To 100 Call DoSomething(iLoop) Next Sub DoSomething(iLoop As Integer) Print iLoop + 10 End Sub Option 2: For iLoop = 1 To 100 Print iLoop + 10 Next 

The two options are very simple examples, but you can see thatif you use the statement Print iLoop + 10 in two or more places, you havea maintenance problem if you ever need to change that line. Option 2, however,will run faster than Option 1.

See also  5 Benefits of Using Time Tracking Software
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist