A function is something you can write and put in your code. You can use it as many times later on in the code without having to write it again and again. The difference between a Sub and a function is that a function returns something.
It's being used in crypters for the encrypting/decrypting alot. Oke lets start
It's being used in crypters for the encrypting/decrypting alot. Oke lets start
Add 2 numbers
Code
Function Add(ByVal intNumber1 As Integer, ByVal intNumber2 As Integer) As Integer
Dim intReturn As Integer
intReturn = intNumber1+ intNumber2
Return intReturn
End FunctionHow we use this:
Code
MessageBox.Show(Add(TextBox1.Text, TextBox2.Text))Even and Odd numbers
Code
Function EvenOrOdd(ByVal intNumber As Integer) As Boolean
If intNumber Mod 2 = 0 Then
Return True
Else
Return False
End If
End FunctionI hope this was a good little tut, if there is interest i will make another to check if a number is a prime number, perfect number etc.. And i will cover a Sub in the next tut and more advanced functions

