Instructions

209 C-Control Pro IDE
© 2013 Conrad Electronic
Sub main()
Dim a As Word
Dim f As Single
func1(128,12.0) ' you can pass Numerical constants
a=100
f=12.0
func1(a+28,f) ' or yet variables too and even numerical expressions
End Sub
When calling up a function all parameters must always be stated. The following call up is inad-
missible:
func1() ' func1 gets 2 parameters!
func1(128) ' func1 gets 2 parameters!
Return Parameters
It is not only possible to pass parameters. A function can also offer a return value. The data type of
this value is during function definition entered after the parameter list of the function.
Sub func1(a As Integer) As Integer
Return a-10
End Sub
The return value is within the function stated as instruction "return Expression". If there is a function
without return value then the return instruction can be used without parameters in order to leave the
function.
References
Since it is not possible to pass on arrays as parameters the access to parameters is possible
through references. For this the attribute "ByRef" is written ahead of the parameter name in the
parameter declaration of a function.
Sub StringLength(ByRef str As Char) As Integer
Dim i As Integer
i=0
Do While str(i)
i=i+1 ' Repeat character as long as unequal zero
End While
Return i
End Sub
Sub main()
Dim Len As Integer
Dim Text(15) As Char