hyTags
HomeHome DocumentationDocumentation

value-scope

Executes a block of commands and returns the last value produced.
Parameter
Type
Description
return
Type?
The expected return type of the scope. If not specified, returns void
commands
Commands
The commands to execute within the scope
return
T
Returns the last value produced by the commands in the scope
Test Case:Scope returns last string value
    <div></div>
    
    <value-scope return="string">
      <string-new value="first">
      <string-new value="second">
    </value-scope>
    <assert-equal value="second" type="string">
    
    👆 Try to change something!
  • Test Case:Scope returns last number value
      <div></div>
      
      <value-scope return="number">
        <number-new value="1">
        <number-new value="42">
      </value-scope>
      <assert-equal value="42" type="number">
      
      👆 Try to change something!
    • Test succeeded Test failed