/*,, Vars.know -- example for local and global variables for testing XbertClass.php
Also shows optional ways to enter comments.
*/,,
,#, set variable 'south' to a value of 180 degrees,'north' to 360 degrees, 'node' to 4
,loc, <node> 4
,glob, <south> 180 degrees
,loc, <north> 360 degrees
# since this rule set starts with node 1, a NO response skips everything.
,,- - - -
,,This is an example for setting and retrieving data
,,using global and local variables.
,Asky, Say YES to see how variables work and test them.
6 ,glob, <count> 1
,, The count starts with <count>. Next 8 is then added to it.
# ,, <total> has not been declared yet so the ADD command creates it as a local variable.
,add, <count> 8 <total>
,,- - - - -
,, 'total' was created and has the value of <total>.
,,This line displays a fixed dollar amount of $29.99.
,ask, How much money do you need? Numeric expected with no $.
# sets the variable txt to the value of the latest reply <> by default
,glob, <txt>
,ask, Say something else!
,glob, <gtxt>
// test ability to substitute variables in a displayed line
,,* * * * *
,,Variable values for 'south' is <south> and 'north' is <north>,
,pau,and for 'txt' it's $<txt> and 'gtxt' is "<gtxt>".
,,- - - -
# the 1st column for the node can be a variable
<node>,,We branched off to node <node>.
,pau, Now testing to see if four variables are set which they should be.
,isl,<node>
,,'node' is a local variable
,isg,<txt>
,,'txt' is a global variable
,iss,<south>
,,'south' is set
,iss,<north> --->additional words here are ignored for this command
,,'north' is set
3 ,,Now testing to see if variables are NOT set.
,pau, You should not see any error messages.
,isl,<count>
,,<er> 'count' should NOT be local.
3 ,isg,<node>
,,<er> 'node' should NOT be global.
3 ,iss, <aaa>
,, <er> 'aaa' should NOT be found anywhere.
3 ,pau,-- Whew -- finally all done.
|