github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/structs/andor_doc.yaml (about)

     1  - DocumentID: and
     2    Title: >+
     3      `and`
     4    CategoryID: commands
     5    Summary: >-
     6      Returns `true` or `false` depending on whether multiple conditions are met
     7    Description: |-
     8      Returns a boolean results (`true` or `false`) depending on whether all of the
     9      code-blocks included as parameters are successful or not.
    10    Usage: |-
    11      ```
    12      and { code-block } { code-block } -> <stdout>
    13  
    14      !and { code-block } { code-block } -> <stdout>
    15      ```
    16  
    17      `and` supports as many or as few code-blocks as you wish.
    18    Examples: |-
    19      ```
    20      if { and { = 1+1==2 } { = 2+2==4 } { = 3+3==6 } } then {
    21          out The laws of mathematics still exist in this universe.
    22      }
    23      ```
    24    Flags:
    25    Detail: |-
    26      `and` does not set the exit number on failure so it is safe to use inside a `try`
    27      or `trypipe` block.
    28  
    29      If `and` is prefixed by a bang then it returns `true` only when all code-blocks
    30      are unsuccessful.
    31  
    32      ### Code-Block Testing
    33  
    34      * `and` tests all code-blocks up until one of the code-blocks is unsuccessful,
    35        then `and` exits and returns `false`.
    36  
    37      * `!and` tests all code-blocks up until one of the code-blocks is successful,
    38        then `!and` exits and returns `false` (ie `!and` is `not`ing every code-block).
    39    Synonyms:
    40    - and
    41    - "!and"
    42    Related:
    43    - or
    44    - if
    45    - try
    46    - trypipe
    47    - catch
    48    - not-func
    49    - "true"
    50    - "false"
    51  
    52  
    53  - DocumentID: or
    54    Title: >+
    55      `or`
    56    CategoryID: commands
    57    Summary: >-
    58      Returns `true` or `false` depending on whether one code-block out of multiple
    59      ones supplied is successful or unsuccessful.
    60    Description: |-
    61      Returns a boolean results (`true` or `false`) depending on whether any of the
    62      code-blocks included as parameters are successful or not.
    63    Usage: |-
    64      ```
    65      or { code-block } { code-block } -> <stdout>
    66  
    67      !or { code-block } { code-block } -> <stdout>
    68      ```
    69  
    70      `or` supports as many or as few code-blocks as you wish.
    71    Examples: |-
    72      ```
    73      if { or { = 1+1==2 } { = 2+2==5 } { = 3+3==6 } } then {
    74          out At least one of those equations are correct
    75      }
    76      ```
    77    Flags:
    78    Detail: |-
    79      `or` does not set the exit number on failure so it is safe to use inside a `try`
    80      or `trypipe` block.
    81  
    82      If `or` is prefixed by a bang (`!or`) then it returns `true` when one or more
    83      code-blocks are unsuccessful (ie the opposite of `or`).
    84  
    85      ### Code-Block Testing
    86  
    87      * `or` only executes code-blocks up until one of the code-blocks is successful
    88        then it exits the function and returns `true`.
    89  
    90      * `!or` only executes code-blocks while the code-blocks are successful. Once one
    91        is unsuccessful `!or` exits and returns `true` (ie it `not`s every code-block).
    92    Synonyms:
    93    - or
    94    - "!or"
    95    Related:
    96    - and
    97    - if
    98    - try
    99    - trypipe
   100    - catch
   101    - not-func
   102    - "true"
   103    - "false"