Minggu, 06 Juni 2010

Subroutine (Procedure and Function)

In programming concepts, especially structured programming, is known the existence of the concept of subroutines. Originally developed to abbreviate the writing subroutine code complicated program if some steps must be performed several times in different places. In addition, the subroutine facility, mnejadi programs more efficient, clear, and the time of writing is also becoming shorter. The term itself indicates the existence of a group of subroutines Commons statement that is part of a program or another subroutine. In Visual Basic there are two types of subroutine, namely the procedures and functions.

Basically the procedures and functions have the same goal, there is only the difference on whether the subroutine is returning a value or not. If returning a value, then called the function, whereas if not, then referred to the procedure.
After a procedure or function is created, then the procedure or function can be called in accordance with a predetermined task on the procedure or function.
Procedure or function can be written on the form or on a special module to put a subroutine .. The difference is the range of usage of these subroutines.

Subroutine in the form, can only be used on the form in which the subroutine is created, while the subroutine contained in the module can be used on all parts of the program. Clearly shows that there is management making program in Visual Basic. The task of determining whether a subroutine is situated on a form or module is a task of the programmer. Programmers are required to make a program that easily managed.

Tidak ada komentar: