Annotations

Navigation:  Language Reference > Keywords >

Annotations

Previous pageReturn to chapter overviewNext page

Introduction

Annotations are properties that can be applied to parameters and variables. Thy have to be entered between brackets, separated by commas, right after the parameter or variable name.

Readonly

The readonly property can only be applied to parameters. You can use it to prevent a parameter value to be changed in the Parameters Editor.

 

 real y (readonly=true) = 20 {kg};                // the mass y, cannot be changed value in the parameters editor

Ranges

Parameters and Variables can be limited in range or restricted by annotations.

 

 real x (range=<-1,1>) = 0.1 {m};                // the position of part x with a min-max range

 

 

Annotations start ( and end with a bracket ). Various elements can be included inside the brackets, separated by semicolons. Annotation have to be placed right after the parameter name. The following annotations are supported:

 

min=0
max=10,1
range=<-17,2.345>
range = [0,1]
range = <,0>

 

 

Brackets mean "equal or". So

 

range = [0,1]

 

means equal or larger than zero and smaller or equal to 1. If one of the element of a range is omitted, this means infinity. So

 

range = [0,]

 

means equal to zero or larger. Larger than or smaller can also be used. So:

 

range = <0,1>

 

means larger than zero and smaller than 1. And

 

range = <0,>

 

means larger than zero.

View

Integers can be entered using a decimal, hexadecimal or binary notation. They are by default, displayed using their decimal notation. You can use the annotations to show an integer in their hexadecimal or binary notation.

 

 integer x ('view=hex') = 0xE2F3;                // the integer is entered in hexadecimal notation

 integer y ('view=hexadecimal');

 integer z ('view=binary) = 0b11011;

Note

The ranges are only checked in debug mode.
No spaces are allowed between the brackets.
Readonly does only apply for parameters.