1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-05-12 08:00:12 +00:00
2 Export
boxgaming edited this page 2023-09-25 14:00:23 -05:00

Specifies the Function(s), Sub(s) and/or Const(s) which will be accessible to programs importing the module.

Syntax

Export sourceItem [As externalAlias]

Parameters

  • The sourceItem specifies the name of the Functions, Subs or Const to export for use by the calling program.
  • The optional externalAlias specifies an alternate name for the exported item. If not specified the internal name will be used.
  • Multiple comma-separated source items can be specified per Export line.

Example

Example 1: Export methods from a sample user-defined math library.

Export increment As Plus1
Export factorial AS Factorial
 
Function increment (num)
    increment = num + 1
End Function
 
Function factorial (num)
    Dim res
    $If Javascript Then
        if (num === 0 || num === 1) {
            num = 1;
        }
        else {
            for (var i = num - 1; i >= 1; i--) {
                num *= i;
            }
       }
    $End If
    factorial = num
End Function

See Also

Import
IncludeJS