2.1 : - Definiton-Command

<< Click to Display Table of Contents >>

Navigation:  2. Components > 4. Special features >

2.1 : - Definiton-Command

 : - Definiton-Command

Previous Top Next


MiniRobotLanguage (MRL)

 

Define Variable, MACRO or Label

 

 

Purpose:

This command can be used to define a Variable, Macro or a Label.

 

 

Define a variable

 

A variable is a placeholder for a numeric or string value.

A variable is replaced at runtime with the value behind.

 

Variables can be used to make your program more readable.

Also variables can save you a lot of typing work.

There are different ways to define a variable. Each of these have their own advantages and disadvantages.

 

If a variable name is used and there is no such variable defined, nothing will happen. It will be processed like normal text. The definition command makes a complete numeric and string resolution of the given values.

 

Using the definition command you can define and clear variables.

 

 

 

Example:

 

'This will clear the variable (set variable value to "empty"):

: $$ABC=

 

' This will assign a Value with complete Specialfolder-Processing

: $$ABC=Hallo

 

' This will assign the content of the Variable including the Variable-Type

' at this time there will be no Processing for Specialfolders etc. its just a COPY.

: $$ABC=$$CDE

 

 

 

Define a Label or Macro

A label is a jump-mark in the code. Program execution can jump to this mark, using the JMP or GSB, and other commands.

 

A Macro is a user-defined command. It may contain several lines of code and parameters.

For Details on the MACRO option see the : - MACRO-Definitions.

For Details on variable-types see the VAR. - Command.

 

How does the robot know what you want?

 

The definiton of a Variable or a MACRO starts with a ": " (colon-blank).

A Label-Definiton may not contain a Blank! A label is defined like this:

 

:Here

 

Note that there can't be a blank after the colon - or it would be taken as the start of a Macro-Definition.

 

' This is a Label

:Label

 

' This is a MACRO:

: %Press 0

MLE.

END%

 

' This will define a script-local Variable.

: §§BBB=99

 

' This will define a global Variable.

: $$BBB=99

 

For Information on Variables please see VAR. - Variable Set Value/Clear.

For Information on Macros please look at : - MACRO-Definitions.

 

 

Syntax:

 

: [Variable]=[P1]

: [Macroname]

:LABEL

 

 

 

Example:

 

'This will clear the variable (set variable value to "empty"):

: $$ABC=

 

' This will assign a Value without Specialfolder-Processing to a global variable

: $$ABC=Hallo

 

' This will assign a Value with Specialfolder-Processing to a local variable

: §§ABC=?path\hallo

 

 

 

Parameter Explanation:

 

-

 

 

Remarks:

 

Its important to understand that the VAR.-Command will resolve Special-Folders and Special Variables, while the ":" Definition-Command will do that and also try a numeric resolution if there is a formula on the value-side.

 

 

 

Limitations:

 

-

 

 

See also:

 

 

  : - MACRO-Definitions

  JMP. - Jump to Label

  JSR. - Jump SubRoutine (Label)

  VAR. - Variable Set Value/Clear