Revision history for KeyPgFunction


Revision [21883]

Last edited on 2017-08-26 01:47:28 by fxm [wording]
Additions:
**Warning:** Whatever the output branch used, the return value must be always defined, otherwise an unexpected behavior may occur.
Deletions:
**Warning:** Whatever the output branch used, the return value must be always defined, otherwise an unpredictable value may be returned.


Revision [21868]

Edited on 2017-08-23 16:47:47 by fxm [Added in the syntax the "byref" optional specifier for returning by reference]
Additions:
[[[KeyPgPublic|Public]]|[[KeyPgPrivate|Private]]] **Function** //identifier// [[[KeyPgCdecl|CDecl]]|[[KeyPgPascal|Pascal]]|[[KeyPgStdcall|StdCall]]] [[[KeyPgOverload|Overload]]] [[[KeyPgAlias|Alias]] //external_identifier//] [([//parameter_list//])] [ [[KeyPgByrefFunction|ByRef]] ] [[[KeyPgAs|As]] //return_type//] [[[KeyPgStatic|Static]]] [[[KeyPgExport|Export]]]
//Returning values// : ##//return_type//## specifies the ##[[DataType|data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng|DefSng]]##, ##[[KeyPgDefdbl|DefDbl]]##, ##[[KeyPgDefstr|DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn|Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. ##[[KeyPgReturn|Return]]## keyword mixed with Function= keyword or function's ##//identifier//##= or ##[[KeyPgExit|Exit Function]]## keyword in a same function is unsupported when returning objects with constructors. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment|assignments]] or ##[[KeyPgIfthen|If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction|ByRef As]] //return_type//##.
Deletions:
[[[KeyPgPublic|Public]]|[[KeyPgPrivate|Private]]] **Function** //identifier// [[[KeyPgCdecl|CDecl]]|[[KeyPgPascal|Pascal]]|[[KeyPgStdcall|StdCall]]] [[[KeyPgOverload|Overload]]] [[[KeyPgAlias|Alias]] //external_identifier//] [([//parameter_list//])] [[[KeyPgAs|As]] //return_type//] [[[KeyPgStatic|Static]]] [[[KeyPgExport|Export]]]
//Returning values// : ##//return_type//## specifies the ##[[DataType|data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng|DefSng]]##, ##[[KeyPgDefdbl|DefDbl]]##, ##[[KeyPgDefstr|DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn|Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. ##[[KeyPgReturn|Return]]## keyword mixed with Function= keyword or function's ##//identifier//##= or ##[[KeyPgExit|Exit Function]]## keyword in a same function is unsupported when returning objects with constructors. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment|assignments]] or ##[[KeyPgIfthen|If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction|Byref As]] //return_type//##.


Revision [21735]

Edited on 2016-12-20 03:45:07 by fxm [Wording]
Additions:
**Warning:** Whatever the output branch used, the return value must be always defined, otherwise an unpredictable value may be returned.
Deletions:
**Warning:** Whatever the output branch used, the return value must be always defined, otherwise an unexpected value may be returned.


Revision [21719]

Edited on 2016-11-27 16:36:23 by fxm [Whatever the output branch used, the return value must be always defined]
Additions:
**Warning:** Whatever the output branch used, the return value must be always defined, otherwise an unexpected value may be returned.


Revision [20933]

Edited on 2016-03-13 01:51:23 by fxm [Formatting]

No Differences

Revision [20251]

Edited on 2016-02-10 16:00:48 by DkLwikki [Update link format]
Additions:
[[[KeyPgPublic|Public]]|[[KeyPgPrivate|Private]]] **Function** //identifier// [[[KeyPgCdecl|CDecl]]|[[KeyPgPascal|Pascal]]|[[KeyPgStdcall|StdCall]]] [[[KeyPgOverload|Overload]]] [[[KeyPgAlias|Alias]] //external_identifier//] [([//parameter_list//])] [[[KeyPgAs|As]] //return_type//] [[[KeyPgStatic|Static]]] [[[KeyPgExport|Export]]]
{ {[[KeyPgReturn|Return]] [//return_value//]}|{Function = //return_value//}|{//identifier// = //return_value//} }
[[KeyPgEndblock|End]] Function
##//parameter//##: ##[[[KeyPgByref|ByRef]]|[[KeyPgByval|ByVal]]] //identifier// [[[KeyPgAs|As]] //type//] [= //default_value//]##
//Access Rights// : The ##[[KeyPgPublic|Public]]## and ##[[KeyPgPrivate|Private]]## keywords specify public or private intra module-level access rights, respectively. If neither is given, the function defaults to public access (##[[KeyPgPublic|Public]]##).
//Calling Convention// : Calling convention, or the order in which arguments are pushed and popped from the stack during function calls, is specified with the ##[[KeyPgCdecl|CDecl]]##, ##[[KeyPgPascal|Pascal]]## and ##[[KeyPgStdcall|StdCall]]## keywords. If none is given, the function uses the standard convention by default (##[[KeyPgStdcall|StdCall]]##).
//Passing Arguments// : Functions may receive one or more variables, or arguments, when called. These arguments are listed as ##//parameters//## in the ##//parameter_list//##. The ##[[KeyPgByref|ByRef]]## and ##[[KeyPgByval|ByVal]]## keywords specify whether the argument will be passed by reference or by value, respectively. The argument's type is given by "##[[KeyPgAs|As]] //type//##" following the ##//parameter//##. If a parameter in the declaration is given a default value, the parameter is optional. Array parameters are specified by following an identifier with an empty parenthesis. Note that array parameters are always ##[[KeyPgByref|ByRef]]## and the ##[[KeyPgByref|ByRef]]## keyword is neither required nor allowed for array parameters. When calling a function with an array argument the parenthesis must be supplied there too; see the examples.
//Overloaded Functions// : An overloaded function may share the same name (##//identifier//##) as another with a different signature. The ##[[KeyPgOverload|Overload]]## keyword specifies that a function may be overloaded. A function must be defined - or declared - using the ##[[KeyPgOverload|Overload]]## keyword prior to any functions that overload them.
//Returning values// : ##//return_type//## specifies the ##[[DataType|data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng|DefSng]]##, ##[[KeyPgDefdbl|DefDbl]]##, ##[[KeyPgDefstr|DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn|Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. ##[[KeyPgReturn|Return]]## keyword mixed with Function= keyword or function's ##//identifier//##= or ##[[KeyPgExit|Exit Function]]## keyword in a same function is unsupported when returning objects with constructors. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment|assignments]] or ##[[KeyPgIfthen|If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction|Byref As]] //return_type//##.
//Local Variable Preservation// : The ##[[KeyPgStatic|Static]]## keyword specifies that a function's locally declared variables are preserved between function calls. Upon entering a function defined with ##[[KeyPgStatic|Static]]##, local variables have the same value as when the function was last called.
- In the //[[CompilerOptlang|-lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString|String]]##; String and user-defined ##[[KeyPgType|Type]]##s are passed ##[[KeyPgByref|Byref]]## by default.
- In the //[[CompilerOptlang|-lang qb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention.
- In the //[[CompilerOptlang|-lang qb]]// dialect, the name of the function must be used in an assignment to specify the return value. Using ##**function** = ...##" to specify the return value may not be used.
- In the //[[CompilerOptlang|-lang qb]]// and //[[CompilerOptlang|-lang fblite]]// dialects, ##[[KeyPgReturn|Return]]## may only be used to return a value when ##[[KeyPgOptiongosub|Option Gosub]]## is off. In //[[CompilerOptlang|-lang qb]]//, this must be done explicitly using the ##[[KeyPgOptionnogosub|Option Nogosub]]## statement.
- Return value can now be specified by a ##[[KeyPgReturn|Return]]## statement.
- Function ##[[KeyPgOverload|Overload]]##ing is supported in ""FreeBASIC"".
- ##[[KeyPgSub|Sub]]##
- ##[[KeyPgExit|Exit]]##
- ##[[KeyPgReturn|Return]]##
- ##[[KeyPgDeclare|Declare]]##
- ##[[KeyPgPublic|Public]]##
- ##[[KeyPgPrivate|Private]]##
Deletions:
[[[KeyPgPublic Public]]|[[KeyPgPrivate Private]]] **Function** //identifier// [[[KeyPgCdecl CDecl]]|[[KeyPgPascal Pascal]]|[[KeyPgStdcall StdCall]]] [[[KeyPgOverload Overload]]] [[[KeyPgAlias Alias]] //external_identifier//] [([//parameter_list//])] [[[KeyPgAs As]] //return_type//] [[[KeyPgStatic Static]]] [[[KeyPgExport Export]]]
{ {[[KeyPgReturn Return]] [//return_value//]}|{Function = //return_value//}|{//identifier// = //return_value//} }
[[KeyPgEndblock End]] Function
##//parameter//##: ##[[[KeyPgByref ByRef]]|[[KeyPgByval ByVal]]] //identifier// [[[KeyPgAs As]] //type//] [= //default_value//]##
//Access Rights// : The ##[[KeyPgPublic Public]]## and ##[[KeyPgPrivate Private]]## keywords specify public or private intra module-level access rights, respectively. If neither is given, the function defaults to public access (##[[KeyPgPublic Public]]##).
//Calling Convention// : Calling convention, or the order in which arguments are pushed and popped from the stack during function calls, is specified with the ##[[KeyPgCdecl CDecl]]##, ##[[KeyPgPascal Pascal]]## and ##[[KeyPgStdcall StdCall]]## keywords. If none is given, the function uses the standard convention by default (##[[KeyPgStdcall StdCall]]##).
//Passing Arguments// : Functions may receive one or more variables, or arguments, when called. These arguments are listed as ##//parameters//## in the ##//parameter_list//##. The ##[[KeyPgByref ByRef]]## and ##[[KeyPgByval ByVal]]## keywords specify whether the argument will be passed by reference or by value, respectively. The argument's type is given by "##[[KeyPgAs As]] //type//##" following the ##//parameter//##. If a parameter in the declaration is given a default value, the parameter is optional. Array parameters are specified by following an identifier with an empty parenthesis. Note that array parameters are always ##[[KeyPgByref ByRef]]## and the ##[[KeyPgByref ByRef]]## keyword is neither required nor allowed for array parameters. When calling a function with an array argument the parenthesis must be supplied there too; see the examples.
//Overloaded Functions// : An overloaded function may share the same name (##//identifier//##) as another with a different signature. The ##[[KeyPgOverload Overload]]## keyword specifies that a function may be overloaded. A function must be defined - or declared - using the ##[[KeyPgOverload Overload]]## keyword prior to any functions that overload them.
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. ##[[KeyPgReturn Return]]## keyword mixed with Function= keyword or function's ##//identifier//##= or ##[[KeyPgExit Exit Function]]## keyword in a same function is unsupported when returning objects with constructors. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction Byref As]] //return_type//##.
//Local Variable Preservation// : The ##[[KeyPgStatic Static]]## keyword specifies that a function's locally declared variables are preserved between function calls. Upon entering a function defined with ##[[KeyPgStatic Static]]##, local variables have the same value as when the function was last called.
- In the //[[CompilerOptlang -lang fb]]// dialect, ##**Byval**## is the default parameter passing convention for all built-in types except ##[[KeyPgString String]]##; String and user-defined ##[[KeyPgType Type]]##s are passed ##[[KeyPgByref Byref]]## by default.
- In the //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, ##**Byref**## is the default parameter passing convention.
- In the //[[CompilerOptlang -lang qb]]// dialect, the name of the function must be used in an assignment to specify the return value. Using ##**function** = ...##" to specify the return value may not be used.
- In the //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, ##[[KeyPgReturn Return]]## may only be used to return a value when ##[[KeyPgOptiongosub Option Gosub]]## is off. In //[[CompilerOptlang -lang qb]]//, this must be done explicitly using the ##[[KeyPgOptionnogosub Option Nogosub]]## statement.
- Return value can now be specified by a ##[[KeyPgReturn Return]]## statement.
- Function ##[[KeyPgOverload Overload]]##ing is supported in ""FreeBASIC"".
- ##[[KeyPgSub Sub]]##
- ##[[KeyPgExit Exit]]##
- ##[[KeyPgReturn Return]]##
- ##[[KeyPgDeclare Declare]]##
- ##[[KeyPgPublic Public]]##
- ##[[KeyPgPrivate Private]]##


Revision [17055]

Edited on 2014-04-27 04:28:22 by FxMwikki [Mixing Return and Function= is unsupported when returning objects with constructors]
Additions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. ##[[KeyPgReturn Return]]## keyword mixed with Function= keyword or function's ##//identifier//##= or ##[[KeyPgExit Exit Function]]## keyword in a same function is unsupported when returning objects with constructors. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction Byref As]] //return_type//##.
Deletions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction Byref As]] //return_type//##.


Revision [17054]

Edited on 2014-04-27 03:50:23 by FxMwikki [Any function result may now be ignored at the call site]
Additions:
- The return value of functions can be ignored in the calling code.
Deletions:
- The return value of integer functions (all numeric types excluding the two floating-point types: single and double) can be ignored in the calling code.


Revision [16715]

Edited on 2013-04-01 08:56:00 by FxMwikki [Now functions can also return references]
Additions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments. Functions can also return references by specifying ##[[KeyPgByrefFunction Byref As]] //return_type//##.
Deletions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values //(and soon, references)// using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments.


Revision [16677]

Edited on 2013-03-24 12:16:28 by FxMwikki [Added rule of parentheses around argument list on function calls in expressions]
Additions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values //(and soon, references)// using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements. Parentheses surrounding the argument list are required on function calls in expressions and even highly recommended if there are no arguments.
Deletions:
//Returning values// : ##//return_type//## specifies the ##[[DataType data type]]## returned by a function upon exit. If no data type is specified, then the function will return the default data type, which will be Integer unless set to another data type using ##[[KeyPgDefsng DefSng]]##, ##[[KeyPgDefdbl DefDbl]]##, ##[[KeyPgDefstr DefStr]]##, etc. Functions can return values //(and soon, references)// using three methods: the ##[[KeyPgReturn Return]]## keyword followed by a value exits the function immediately, and returns that value to the caller. Functions can also return values by assigning the Function keyword or the function's ##//identifier//## to the desired return value. The latter two methods do not cause the function to exit, however. Since functions return values, function calls evaluate to expressions. Thus, function calls can be made wherever an expression is expected, like in [[KeyPgOpAssignment assignments]] or ##[[KeyPgIfthen If]]## statements.


Revision [15882]

Edited on 2012-01-29 11:07:35 by FxMwikki [Remove ambiguity between 'Integer' (data-type) and 'integer' (numeric type excluding floating-point)]
Additions:
- The return value of integer functions (all numeric types excluding the two floating-point types: single and double) can be ignored in the calling code.
Deletions:
- The return value of ##[[KeyPgInteger Integer]]## functions (all integer types) can be ignored in the calling code.


Revision [15040]

Edited on 2011-01-30 04:23:21 by FxMwikki [Remove ambiguity between 'Integer' (data-type) and 'integer' (numeric type excluding floating-point)]
Additions:
- The return value of ##[[KeyPgInteger Integer]]## functions (all integer types) can be ignored in the calling code.
Deletions:
- The return value of ##[[KeyPgInteger Integer]]## functions can be ignored in the calling code.


Revision [14765]

Edited on 2010-08-20 06:52:25 by GaLeon [Added period in Differences from QB section]
Additions:
- Return value can now be specified by a ##[[KeyPgReturn Return]]## statement.
Deletions:
- Return value can now be specified by a ##[[KeyPgReturn Return]]## statement


Revision [13864]

Edited on 2008-11-01 03:34:03 by DoS386 [double -> single]
Additions:
Declare Function ReturnTen Overload (a As Single) as integer
Print ReturnTen (10.000!) '' ReturnTen will take a single and return an integer
Function ReturnTen Overload (a As Single) as integer
Deletions:
Declare Function ReturnTen Overload (a As Double) as integer
Print ReturnTen (10.000!) '' ReturnTen will take a double and return an integer
Function ReturnTen Overload (a As Double) as integer


Revision [13808]

Edited on 2008-10-22 07:18:11 by CountingPine [Additional difference from QB]
Additions:
- In QBASIC, the return type could only specified with a suffix, not with ##AS TYPE##, and only allowed functions to return a built-in type.


Revision [13807]

Edited on 2008-10-22 07:15:46 by CountingPine [Sentence missing a word; slight See Also reordering]
Additions:
- In the //[[CompilerOptlang -lang qb]]// dialect, the name of the function must be used in an assignment to specify the return value. Using ##**function** = ...##" to specify the return value may not be used.
Deletions:
- In the //[[CompilerOptlang -lang qb]]//, the name of the function must be used in an assignment to specify the return value. Using ##**function** = ...##" to specify the return value may not be used.


Revision [13800]

Edited on 2008-10-22 04:17:46 by DoS386 [duplicate, formatting, esp. in FBHELP [3] +see]
Additions:
- ##[[KeyPgReturn Return]]##


Revision [13797]

Edited on 2008-10-22 03:55:52 by DoS386 [duplicate, formatting, esp. in FBHELP [2]]
Additions:
Print ReturnTen (10.000!) '' ReturnTen will take a double and return an integer
Print ReturnTen (10) '' ReturnTen will take an integer and return an integer
Print ReturnTen ("10") '' ReturnTen will take a string and return an integer
'' functions taking array arguments.
Deletions:
Print ReturnTen (10.000!) '' ReturnTen will take a double and return an integer
Print ReturnTen (10) '' ReturnTen will take an integer and return an integer
Print ReturnTen ("10") '' ReturnTen will take a string and return an integer
'' functions that take array arguments.


Revision [13792]

Edited on 2008-10-22 03:09:32 by DoS386 [duplicate, formatting, esp. in FBHELP]
Additions:
'' This program demonstrates the declaration of a function
'' and returning a value using Return command
Print ReturnTen () '' ReturnTen returns an integer by default.
'' This program demonstrates the declaration of a function
'' and returning a value using assignment to function name
Print ReturnTen () '' ReturnTen returns an integer by default.
'' This program demonstrates function overloading.
'' The overloaded functions must be FIRST.
Print ReturnTen (10.000!) '' ReturnTen will take a double and return an integer
Print ReturnTen (10) '' ReturnTen will take an integer and return an integer
Print ReturnTen ("10") '' ReturnTen will take a string and return an integer
'' The following example demonstrates optional parameters.
'' This example shows how to declare and call
'' functions that take array arguments.
Deletions:
'This program demonstrates the declaration of a function and said function returning a value.
Print ReturnTen () 'ReturnTen returns an integer by default.
'This program demonstrates the declaration of a function and said function returning a value.
Print ReturnTen () 'ReturnTen returns an integer by default.
'This program demonstrates function overloading.
'The overloaded functions must be FIRST.
Print ReturnTen (10.000!) 'ReturnTen will take a double and return an int.
Print ReturnTen (10) 'ReturnTen will take an int and return an int.
Print ReturnTen ("10") 'ReturnTen will take a string and return an int.
' The following demonstrates optional parameters.
This example shows how to declare and call functions that take array arguments.


Revision [13680]

Edited on 2008-09-02 09:18:41 by CountingPine [Fix default byval ambiguity; misc edits]
Additions:
- In the //[[CompilerOptlang -lang qb]]//, the name of the function must be used in an assignment to specify the return value. Using ##**function** = ...##" to specify the return value may not be used.
- In the //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects, ##[[KeyPgReturn Return]]## may only be used to return a value when ##[[KeyPgOptiongosub Option Gosub]]## is off. In //[[CompilerOptlang -lang qb]]//, this must be done explicitly using the ##[[KeyPgOptionnogosub Option Nogosub]]## statement.
- Parameters can be optional in ""FreeBASIC"".
- Function ##[[KeyPgOverload Overload]]##ing is supported in ""FreeBASIC"".
- The return value of ##[[KeyPgInteger Integer]]## functions can be ignored in the calling code.
Deletions:
- In the //[[CompilerOptlang -lang qb]]//, the name of the function must be used in an assignment to specify the return value. Using ##function## or ##return## to specify the return value may not be used.
- In the //[[CompilerOptlang -lang fb]]// dialect the parameters are passed ##[[KeyPgByval ByVal]]## by default. //[[CompilerOptlang -lang qb]]// and //[[CompilerOptlang -lang fblite]]// dialects keep the QB convention: parameters are ##[[KeyPgByref ByRef]]## by default.
- Parameters can be optional in FreeBASIC.
- Function overloading supported.
- The return value can be ignored in the calling code.


Revision [12829]

The oldest known version of this page was created on 2008-04-01 15:47:29 by JeffMarshall [Fix default byval ambiguity; misc edits]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode