Deutsch English
Alphabetical index
Array functions
CGI functions
Data types
Date functions
Debugging
Fulltext functions
Language elements
  • 'ANWEISUNGEN'
  • 'AUSDRÜCKE'
  • 'BEZEICHNER'
  • DEF
  • IF
  • 'INDEXBESCHREIBUNG'
  • 'KONSTANTEN'
  • MODULE
  • PROCEDURE
  • REPEAT
  • RETURN
  • USES
  • VAR
  • WHILE
    Numerical functions
    Operators
    Other functions
    Ramtext functions
    Selecting
    Socket functions
    Statistical functions
    Stream functions
    String functions
    System functions
    Table functions
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex Language elements
    Function VAR
    Short Defines a variable or a group of variables
    Syntax VAR Bezeichner {, Bezeichner} : Typ [= Ausdruck]
    Parameter type:

    BYTE (number 0..255)
    INTEGER (number -2147483648 to +2147483647)
    REAL (floating point number with about 18 significant digits)
    CHAR (1 character)
    STRING (max 255 chararcters)
    TBITS (1 Bit)
    MARKS (marking list)
    With all of this basic types also array with max 10 dimensions can be defined:

    VAR Matrix : REAL[10,10]

    The first field index is always 0

    Expression: arithmetic expression of the specified type.
    Return
    See also:
    Description By specification of an expression all variables of the list are initialised with that value.

    At present (Version 6.2.6) fields can not be initialised on this way. They are always initialised with 0 resp. the empty string.

    Is no expression specified, the variables are initialised with the following values:

    BYTE, INTEGER, REAL : 0
    STRING, CHAR : ''
    MARKS :
    TBITS : reset Bit

    Initialisation

    The expression is not calculated and assigned when compiling but at runtime(!). That again means, that self defined functions can be used here. Therefor an example:
    MODULE counter; //  location: lib/counter.mod
    
    PROCEDURE Init : REAL;
    VAR result, ec_before : INTEGER;
      ec_before:=getpara('ec'); setpara('ec 1');
      result:=opendb("database/counter/counter.dat","",0,15);
      setpara('ec '+str(ec_before));
      IF result=0 THEN
        cgiwriteln('content-type: text/html');
        cgiwriteln('');
        cgiwriteln('database-error: '+TDB_ErrorStr(TDB_LastError));
        HALT
      ELSE
        RETURN result;
      END
    ENDPROC;
    
    VAR db : INTEGER = Init;


    If another programm accesses to that module, after

    USES counter.mod;

    a valid (and opened for writing) table handle (of the table database/counter/counter.dat) is available.

    User comments:
    Write a comment:
    Name
    EMail
    Subject
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat
    irc.tdbengine.org
    #tdbengine

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}