Getting To Know MAYBE: the "anti-DEFAULT"

DEFAULT exists to run a block of code to give something a value if it doesn't have one already.

 >> x: ~
 >> x: default [10 + 20]
 >> print x
 30

 >> x: <some-tag>
 >> x: default [10 + 20]
 >> print x
 <some-tag>

By request of @gchiu, we have an "anti-default". Rather than make the decision of whether to overwrite or not based on the content of the variable (and only sometimes evaluate the block)... it always evaluates the block. Then it decides whether to overwrite or not based on the result of that evaluation.

Graham's original name suggestion was UPDATE (which was used for a PORT! action, but not seemingly a very interesting one).

Other suggestions were "MIGHT", "COULD", "PERHAPS"...

But I decided the best name was MAYBE.

>> x: <some-tag>
>> x: maybe if 1 = 2 [<unused-tag>]
>> print x
<some-tag>

>> x: <some-tag>
>> x: maybe if 1 = 1 [10 + 20]
>> print x
30

While simple conditionals can move assignments into the block of code, e.g. x: if c [v] => if c [x: v], more complex instances might have several points they'd have to selectively do the same assignment:

number-of-variants: maybe case [
    whatever1 [do some stuff, 1020]  ; update for this case
    whatever2 [do some stuff, void]  ; don't update in this case
    whatever3 [do some stuff, 304]  ; update for this case 
]  ; don't update if no matches

It's Useful. Use It!

:man_cartwheeling: