Subroutines

Subroutines are always of a great concern in large program because the can help the programmer from writing the similar codes many times when s/he needs them.

 

Structure of a Subroutine and Calling them:

.......
.......
.......
.......
.......
.......
.......
Call <Subroutine_name>
.......
.......
.......
.......
.......
.......
.......
.......
.......
Subroutine <Subroutine_name>
    .......
    .......
    .......
    .......
    .......
    .......
EndSub

 

 

Example : 

Integer i
i = 0
Do
    Println "i=" + i + "    ,    Sin(i)=" + SinD(i)
    Call DrawLine
While SinD(i)<0.8

Subroutin DrawLine
    Integer j
    For j = 1 To i*2
        Print "-"
    Next
    Println ""
EndSub