Datatypes

All values in wxb are stored as Variants. However, the variant will be one of the following types:

These value have common properties:

    integer = variant.GetType()
    string = variant.ToString()
    integer variant.Equal( otherValue )
    integer variant.Compare( otherValue )
    clone = variant.Clone()
However, not all datatypes implement these properties.

Nothing

Nothing is akin to other language's nil or null value. In a truth test, it evaluates to False. All unassigned variables default to Nothing, even if they have been declared as some other type. You can directly test for a value of Nothing:

   If a = Nothing Then
      Print "a = Nothing"
   End If
It implements the following methods:

    isNumeric
    fromChar
    toChar
    isTrue


Integer

Integer is a integer. It is stored as an int value, although all math operations are internally done with double, even if both types are declared as Integer.

Number

Number is a floating point number, stored as a C double. All math operations in wxb are internally done with a Number type, even if the datatype is declared differently.

String

String is an alphanumeric string. When tested in a truth operation, an empty string returns False, and a non-empty string returns True. You can embed special characters into the string by using the backslash (\)

    \n    newline
    \r    carriage return
    \t    tab
    \'    single quote (not really needed)
    \"    double quote
    \\    backslash
For example:

   stringWithANewline = "This is the first line\nThis is the second"
You can treat a string as if it were a collection. You iterate through a string. For example:

   For Each position, letter In "Hello, World"
      Print "Position="; position, "Letter="; letter
   End For
You can also index and slice a string like an array. For example:

   Print "Hello, World"[8]
prints "W", and:

   Print "Hello, World"[1:5]
prints "Hello".

DateTime

DateTime represents a date and time. It is normally created by calling the routine TimeValue:

   Dim myDate = TimeValue( "Jan 12, 2003" )
You can extract the parts of the date by calling the various methods (also available as builtin functions):

   myDate.Year()
   myDate.Month()
   myDate.MonthName()
   myDate.Weekday()
   myDate.Day()
   myDate.DayName()
   myDate.Hour()
   myDate.Minute()
   myDate.Second()
DateTime values can be compares for exact equality or inequality. To determine specific differences between dates, use DateDiff (see the DateDiff function for details).

Object

Any data declared with a Class (builtin or user declared) is stored as a datatype Object. Objects are passed by reference, not by value. If you want to create a unique copy of an Object, use the Clone method:

   myCopy = theObject.Clone()
Objects are reference counted, and automatically destroyed when no object refers to them anymore. For more information about objects, see the section on Classes.

Routine

A Routine is a user-defined routine or method. There is currently only an internal datatype.