- Output field: Returns a system user property, or assigns system user property with a value, or executes a system user method.
<u>property</u>
<u>property = expression</u>
<u>property ++</u>
<u>property --</u>
<u>method(args)</u>
Description
The u element works exactly same as "user" element except it handles system user object
This element loads the user object, executes a piece of system JavaScript code, and returns the results. It is the only way to execute the system BrainJS codes in Output field, with BrainXML. The specific codes to execute depend on what parameter is provided.
Parameters
property
Return the value of JS code "u.property," which is defined under Properties, Codes tab.
property = expression
Calculate the BrainXML expression right to the equation mark; set the value of u.property as the result, in other words, execute JS code "u.property = result;"; and finally return the result.
property ++
Increases the value of property by 1 and returns the result. This only works for integer. If the property is not an integer, the property is returned as-is.
property --
Decreases the value of property by 1 and returns the result. This only works for integer. If the property is not an integer, the property is returned as-is.
method(args)
Execute JS code "u.method(args);" and return the result. Depending on how the method is defined and used, the args can be empty or several comma separated arguments. The method must be pre-defined under Methods, Codes tab.
Examples
Example 1. Set and get a system user property
- 1
- I like *
-
I like <u>like = <s/></u> too!
- 2
- What I like
-
You said you like <u>like</u>.
- I like pizza
- I like pizza too!
- ...
- What I like?
- You said you like pizza.
Example 2. Execute system user method
- 1
- Hello
- Hi,
<u>getName()</u>
!
- Hello!
- Hi, Tom!
Notes
- You cannot modify system user object. However you can create your own custom user object and invoke it with "user" element.