$Setg: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (add <var>'s)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<p>The $SETG function performs two tasks. It attempts to create or change an entry in the global variable table and also informs the user if the operation was successful. $SETG returns a 1 (true) if the global variable was not stored due to lack of space. It returns a 0 (false) if the variable was successfully stored.         </p>
<p>
<p>$SETG takes two arguments. The first argument contains the name of the global variable; the second argument contains the value. Previously stored variables with the same name are deleted first.</p>
The <var>$Setg</var> function performs two tasks. It attempts to create or change an entry in the global variable table and also informs the user if the operation was successful. <var>$Setg</var> returns a 1 (true) if the global variable was not stored due to lack of space. It returns a 0 (false) if the variable was successfully stored. </p>
<b>Example</b>
<p>
<p>The following statement attempts to store a global variable with a name of GLOB and with a value equal to the character string returned from the $READ. A message is to be printed if the operation was not successful.</p>
<var>$Setg</var> takes two arguments. The first argument contains the name of the global variable; the second argument contains the value. Previously stored variables with the same name are deleted first. </p>
 
==Example==
<p>
The following statement attempts to store a global variable with a name of <code>GLOB</code> and with a value equal to the character string returned from the <var>$Read</var>. A message is to be printed if the operation was not successful.
</p>
<p class="code">IF $SETG('GLOB',$READ('ENTER GLOBAL VALUE')) THEN
<p class="code">IF $SETG('GLOB',$READ('ENTER GLOBAL VALUE')) THEN
     PRINT 'HELP'
     PRINT 'HELP'
END IF  
END IF  
</p>
</p>
<p>Refer to [[Global features]] for a detailed explanation of global variables and examples of the $SETG function within a request.   </p>
 
==See also==
<p>
Refer to [[Global features]] for a detailed explanation of global variables and examples of the <var>$Setg</var> function within a request. </p>


[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 19:12, 7 August 2018

The $Setg function performs two tasks. It attempts to create or change an entry in the global variable table and also informs the user if the operation was successful. $Setg returns a 1 (true) if the global variable was not stored due to lack of space. It returns a 0 (false) if the variable was successfully stored.

$Setg takes two arguments. The first argument contains the name of the global variable; the second argument contains the value. Previously stored variables with the same name are deleted first.

Example

The following statement attempts to store a global variable with a name of GLOB and with a value equal to the character string returned from the $Read. A message is to be printed if the operation was not successful.

IF $SETG('GLOB',$READ('ENTER GLOBAL VALUE')) THEN PRINT 'HELP' END IF

See also

Refer to Global features for a detailed explanation of global variables and examples of the $Setg function within a request.