DataBasic Reference > DataBasic Elements > Assignments

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

RealityV15.1Online Documentation (MoTW) Revision 7

Assignments (DataBasic) (m618702+assignments.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

Assignments

The simple assignment statement assigns a value to a variable.

Syntax

{LET }variable = expression

where:

variablewhere the result of expression is to be stored.

expressionis any valid DataBasic expression.

Comments

The word LET is optional and is implied by the = sign. It is therefore omitted from any examples. You can, however, include it if you wish to enhance readability.

The debugger displays a runtime error message if a variable is referenced before it has been assigned a value.

Examples

ABC = 500

assigns the value 500 to variable ABC.

ABC = 500
X = (ABC + 100)/2

assigns the arithmetic expression (ABC + 100)/2, which evaluates to 300, to the variable X.

VALUE = "THIS IS A STRING"

assigns the string THIS IS A STRING to the variable VALUE.

SUB = VALUE[6,2]

performs the substring extraction, where VALUE = "THIS IS A STRING", and assigns the substring "IS" to variable SUB. Refer to the sections Substring Extraction and Substring Assignment.

RealityV15.1 (MoTW) Revision 7Comment on this topic