Difference between SUB and function

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Difference between SUB and function

Postby juhuwoorps » Wed Jul 07, 2010 6:39 pm

Hi at all!

I'm curios to know whats the difference between a Sub routine and a function!

So far I have seen there is no big difference, but there must be one because its splitted.

So please help me to understand this!

TiA juhu
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby ShadowHunter » Wed Jul 07, 2010 9:55 pm

Hi,

Sub: accepts values but doesn't return something
Function: like sub but can return a value

Example:

Sub Add (X As Integer ,Y As Interger)
MsgBox "Sum is" & X+Y
End Sub

Function Add (X As Integer ,Y As Interger) As Integer
Add = X+Y
End Function

So, here Add will have the value of X+Y

Hope this makes sense :D

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests