49
edits
(→Notes) |
|||
| (7 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
Sets an existing variable in the current context, reports variable value. | Sets an existing variable in the current context, reports variable value. | ||
<kua>bob fred</kua> | <kua>bob fred</kua> | ||
== Arguments == | |||
* name - name for variable to set | |||
* value (optional) - the value to set. If no value, then prints value if exists. | |||
== Associations == | == Associations == | ||
* Is the default command for the 'global' context. | * Is the default command for the 'global' context. | ||
* Does not have its own command name in 'global'. | * Does not have its own command name in 'global'. | ||
== Details == | == Details == | ||
| Line 21: | Line 21: | ||
== Examples == | == Examples == | ||
=== Default values === | === Default values === | ||
<kua> | <kua> | ||
> bob | > bob | ||
Unknown: bob | Unknown: bob | ||
</kua> | </kua> | ||
No 'bob' in the context. Variable 'bob' doesn't exist, and 'bob' is not the name of anything else. | |||
<kua> | <kua> | ||
> bob fred | > bob fred | ||
Unknown: bob | Unknown: bob | ||
</kua> | </kua> | ||
Tries to set variable 'bob' to 'fred'. Fails as 'bob' does not exist. | |||
<kua> | <kua> | ||
> set bob fred | > set bob fred | ||
</kua> | </kua> | ||
Uses the 'set' command to create the variable 'bob' and set value to 'fred'. | |||
<kua> | <kua> | ||
> bob | > bob | ||
'bob' is 'fred' | 'bob' is 'fred' | ||
</kua> | </kua> | ||
Same as the first example, but now 'bob' exists. | |||
<kua> | <kua> | ||
> bob james | > bob james | ||
| Line 46: | Line 49: | ||
'bob' is 'james' | 'bob' is 'james' | ||
</kua> | </kua> | ||
Tries to set existing 'bob' to 'james', value changes. | |||
=== Change if exists === | === Change if exists === | ||