Fragments de syntaxe

Fragments de syntaxe LibreOffice Basic

fragment d'argument

fragment d'argument


      {[Optional [ByRef|ByVal]]|ParamArray} argument {{As typename|char}[ = expression]|[()]As Variant}
    

Paramètres

Optional : l'argument n'est pas obligatoire.

ByRef: l'argument est passé par référence. ByRef est par défaut.

ByVal: l'argument est passé par valeur. Sa valeur peut être modifiée par la routine appelée.

char: caractère de déclaration Type

typename: nom du type de données primitif. Les types définis par la bibliothèque ou le module peuvent également être spécifiés.

=expression: spécifiez une valeur par défaut pour l'argument, correspondant à son type déclaré. Optional est nécessaire pour chaque argument spécifiant une valeur par défaut.

ParamArray: Use ParamArray when the number of parameters is undetermined. A typical scenario is that of a Calc user-defined function. Using ParamArray should be limited to the last argument of a routine.

tip

UsingParamArray or = expression require Option Compatible to be placed before the executable program code in a module.


warning

When using Option VBASupport 1, Optional arguments with no default value (= expression) are initialized according to their data type, except if Variant.


array fragment

array fragment


      ( [[start To] end], .. )
    

Parameters

start: Lower bound of a dimension.

end: Upper bound of a dimension.

Multiple dimensions for an array are denoted using comma (,) sign.

typename fragment

primitive data types fragment


      {Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Variant}
    

char fragment

type declaration characters


      { % | & | ! | # | $ | @ }