Data Types

From CometWiki

Jump to: navigation, search

Data Types

The Internet Basic language supports two data types: string and numeric. String data may include alphanumeric characters, special characters, and hex values. Numeric data may include digits, a decimal point, and a minus sign only.

String data String data may be classified as constant or variable. String constants (sometimes called string literals) are characters enclosed in quotation marks (single or double). String constants may contains up to 254 characters. For example, the following are considered string constants:

String constant Explanation
"Signature Systems, Inc." alphabetic characters
"4325 Harrison Grade Road" alphanumeric characters
"(707) 874-1250" alphanumeric and special characters
"@FF@" hex constant FF
"@2020@" hex constant 2020

String variables are named memory locations used to store string data (up to 254 characters per variable). In Internet Basic, string variable names may be any number of characters long, although the compiler recognizes only the first 30 characters of the name. String variable names may be upper or lower case, may include imbedded decimal points, and must end with a dollar sign ($) character. They may not include imbedded blanks or other special characters. For example, the following are valid string variable names:

     CUSTOMER$               customer$
     PARTNUMBER$             Part.number$      part.number$
     A$                      a$
     VALUE1$                 value1$
     CITYSTATEZIPCODE$       City.State.ZIP$

In Internet Basic, all variables must be defined before they can be used. These definitions include the variable name, type (string or numeric), length, and classification. For more information, see the documentation.

Numeric data Numeric data may also be classified as constant or variable. Numeric constants are fixed numeric values included in a program; they may contain digits, a decimal point, and a trailing minus sign. Commas are not allowed in numeric constants. Numeric constants may contain up to 16 digits, 15 of which may be located to the right side of the decimal point. For example, the following values are numeric constants:

     100
     1234.56
     2500.9999-
     1.234567890123456
     1234567890123456.

Numeric variables are named memory locations used to store numeric data (up to 16 digits per variable). In Internet Basic, numeric variable names may be any number of characters long, although the compiler recognizes only the first 30 characters of the name. Numeric variable names may be upper or lower case and may include imbedded decimal points. They may not include imbedded blanks or other special characters. For example, the following are valid numeric variable names:

     CREDITLIMIT             Credit.limit
     AROVER120               AR.over.120
     INVENTORYVALUE          inventory.value
     X                       x
     AMOUNT                  amount

In Internet Basic, all variables must be defined before they can be used. These definitions include the variable name, type (string or numeric), length, and classification. For more information, see the Data Division documentation.

Personal tools