Initializing help system before first use

setscalarvalue

setscalarvalue


Purpose
Update the value of a scalar variable
Synopsis
procedure xreflect~setscalarvalue(entityname:string,newvalue:xreflect~basicvalue)
Arguments
entityname 
The name of the public entity to set
newvalue 
The value to assign to the entity
Example
The following:
public declarations
  myvar: string,
end-declarations
setscalarvalue('myvar',basicvalue('hello'))
writeln('myvar=',myvar)
produces this output:
myvar=hello
Further information
1. If the specified entity name cannot be found, the model will terminate with a runtime error.
2. If the specified entity is not of a supported type, the model will terminate with a runtime error.
3. If the specified entity is not a scalar variable or constant, the model will terminate with a runtime error.
4. If the provided basicvalue contains a value of a different type from the specified entity, the model will terminate with a runtime error.
5. If the specified entity is a constant, the model will terminate with a runtime error unless the provided basicvalue contains the same value as the constant entity.
Related topics