addsetelement
addsetelement |
Purpose
Add a new element to a named set
Synopsis
procedure xreflect~addsetelement( entityname:string, newvalue:xreflect~basicvalue )
Arguments
entityname
|
The name of the public entity to add to
|
newvalue
|
The value to add to the entity
|
Example
The following:
public declarations myvar: set of integer, end-declarations myvar := {1,2,3} addsetelement('myvar',basicvalue(4)) writeln('myvar=',myvar)
produces this output:
myvar={1,2,3,4}
Further information
1. If the specified set already contains the new value, it will be unchanged.
2. If the specified entity name cannot be found, the model will terminate with a runtime error.
3. If the specified entity is not a set of a supported type, the model will terminate with a runtime error.
4. If the supplied
basicvalue does not contain a value of the same type as the specified set, the model will terminate with a runtime error.
5. If the specified entity is a constant set, the model will terminate with a runtime error unless the given value is already in the set.
Related topics