Why we use Subroutine?

Subroutine are useful because they alimenate redancy, making the entire program easier to manage.

CREATING A SUBROUTINE

Creating a Subroutine involves two line of code

 Sub Text Sub()

End Sub

A Subroutine start with the “Sub” followed by a space, then a name identifying the Subroutine. A Subroutine can be called and 1 of 2 ways using the call keyword or by simple stating its name.

Example1:

Sub Text Sub()

Msg Box “Code in text Sub()”

End Sub.

Example2:

Private Sub form-load()

Msg Box “Code in form-load()”

Text Sub or call Text Sub

Msg Box “Back in form-load()”

End Sub.

COMMENT

A comment is a line that is not a source code it is the guidance’s to the person reading the code. Comment began as in a strophe “,” end with a new line.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s