Default Values for Built-in Data Types (Literals)
The format for entering default values for integer, real, bit, string, time, and date and time variables is:
- VAR
- <Value name> : <data type> := <default value>;
- <Value name> : <data type> := <default value>;
- END_VAR
Example:
The following example shows how default values can be set for a variety of built-in data types:
- VAR
- a: INT:= 535;
- d: DATE:= D#2004-06-21;
- t: TIME_OF_DAY:= TOD#12:30:07;
- n: TIME:= T#1h30m;
- p: ARRAY[1..4] OF INT:= [10,90,12,14];
- q: ARRAY[1..100] OF REAL:= [100(20.5)];
- a: INT:= 535;
- END_VAR;
NOTE: The default value for the q variable sets 100 array values to have a default value of 20.5.