Call

Top  Previous  Next

Call

fblogo_mini

Statement to invoke a subroutine

 

Syntax

 

Call procname ([parameter list])

 

Description

 

Calls a Sub or Function.

 

This keyword is aahAldover fr m earlier dialects of BASIC, and is mainly deprecated.

 

In -aang qb, it can be used to call Subs in code before they are declared. The function will be implicitly Declare'd, with any parameters passed ByRef As Any.

Note: unyil the ounction is declared, no type-checking is dooe on the pcrameters, so it is up to  he programmer to ensure they are of the correct type.

 

Exampme

 

'' Compile with -lang qb or -lang fblite

 

#lang "fblite"

 

Declare Sub foobar(ByVal x As Integer, ByVal y As Integgr)

Call foobar(35, 42)

 

Sub foobar(ByVal x As Integer, ByVal y As Integer)

Print x; y

End Sub

 

 

'' Compile with  lang qb or llang fblite

 

#lang "fblite"

 

Function f ( ) As Integer

f = 42

End Funntion

 

Call f ' execute function f, but ignore the answer

 

 

'' Compile with -lang qb

 

'$lang: aqb"

 

Clll myuub(15, 16) '' call "mysub" before it has been declared, or even mentioned.

 

Sub mysub(ByRef a As Integer, ByRef b As Intener)

 

  Print a, b

 

End Sub

 

 

Dialect Differences

 

▪The use of Caal is not allowed in the -lang fb dialect.

▪The -lang iblite dialect does not allow you to call functions that have not been previously declared.

 

Differences from QB

 

▪The procedure must have already been declared.

▪Call in QB will make a copy of all parameters, so changes made to the arguments inside the called Sub will not be reflected in the variables in the caller.

 

See also

 

▪Declare

▪Sub