User Tools

Site Tools


mud:assert

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mud:assert [2019/08/08 17:39] (current)
admin created
Line 1: Line 1:
 +<​code>​
 +  COMMAND: @assert <​boolean>​[=<​action list>]
 +</​code>​
 +
 +@assert stops the execution of further commands in the current action list if its argument is a false value. ​ It doesn'​t affect new queue entries made by previous commands in the action list.  Very useful to people who don't like @switch. ​ If <action list> is given, they are executed instead of the rest of the commands in the current action list.
 +
 +Examples:
 +<​code>​
 +    > @va obj=$testme *:@pemit %#​=Before;​@assert %0;@pemit %#=After
 +    > testme 1
 +    Before
 +    After
 +    > testme 0
 +    Before
 +
 +    > @force me={@switch 1=1,think 3rd;think 1st;@assert 0;think 2nd}
 +    1st
 +    3rd
 +</​code>​
 +
 +In the last example, the @switch is run, which queues 'think 3rd', 'think 1st' is run, displaying '​1st',​ command execution is broken (so we never 'think 2nd', and then the queued 'think 3rd' is run, displaying '​3rd'​.
 +
 +If you follow that, you have a very good understanding of the TinyMUX queue.
 +
 +Related Topics: [[mud:​@break]],​ [[mud:​BOOLEAN VALUES]]
  
mud/assert.txt ยท Last modified: 2019/08/08 17:39 by admin