Variable

From BR Wiki
Revision as of 12:15, 5 January 2012 by Mikhail.zheleznov (talk | contribs) (edit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are two categories of variables in Business Rules!.

  1. Numeric
  2. String

Additionally either of these types of variables may be contained in arrays.

Naming Requirements

Variable Naming Requirements apply to both String and Numeric variables.

  • May contain any letter, number or underscore.
  • Must begin with a letter or an underscore.
  • May not contain dashes, spaces or any characters other than letters and underscores. In other words, characters such as - , ; : * ! @ # $ % ^ & ( ) + and many others are not allowed in a variable name.
  • May not exceed 30 characters.
  • May not start with "fn" as that prefix is reserved for User Defined Functions.
  • BR variable names are case-insensitive, so myVariable$ and Myvariable$ will refer to the exact same variable.
  • String variable names must end with a $.


Numeric

Numeric variables are one of two variable types available in BR.

Example

00010 let a = 10
00020 let b = a + 1
00030 let c = 2 * b

To learn more about the use of numeric variables, refer to the Numeric operators section


String

<1-30 alphanumeric characters and underscores, the first of which must be a letter (but not FN) which ends in a $. They also cannot be reserved words>

A string or string variable is a variable which may contain any type of characters. Strings are one of the two types of variables available in BR, the other is numeric. Strings may be formed into arrays of strings.

  • All normal Variable Naming Requirements apply
  • Variable name must end with $ (the $ does not count against the 30 character variable name limitation)
  • Default Dim Length of 18 characters

Below is an example of the use of a string in a short program:

00010 let myString$ = "BR kicks butt"
00020 print myString$

To learn more about the use of string variables, refer to the String Operations section.