hyTags
HomeHome DocumentationDocumentation

var-update

Updates a variable by passing its current value to commands and storing the result.
Parameter
Type
Description
name
String
Name of the variable to update
commands
Commands
Commands to execute with the current value as initial stack value
return
void
No return value.
Test Case:Increment a number variable
    <div></div>
    
    <var-set name="count" value="10" type="number"></var-set>
    <var-update name="count">
      <number-add value="5">
    </var-update>
    <var-get name="count">
    <assert-equal value="15" type="number">
    
    👆 Try to change something!
  • Test Case:Append to a string variable
      <div></div>
      
      <var-set name="text" value="hello"></var-set>
      <var-update name="text">
        <string-append string=" world">
      </var-update>
      <var-get name="text">
      <assert-equal value="hello world" type="string">
      
      👆 Try to change something!
    • Test succeeded Test failed