Closed boeckmann closed 1 year ago
While this is nice it is nothing that can not be done with an .IFNDEF. Also it is not so common.
Hahaha!
This gives opportunity to some fun:
FOO = C64 ?: APPLE2 ?: $DEAD .echo "Haha, foo is ",[$]FOO
On the commandline, with a -DC64=100 and/or -DAPPLE2=2 you can create fun output.
For real use, this could be used to "get" the type of target into a single variable, based on what target was -D'd on the commandline..
Yeah, it has some nice characteristics. Do you think its useful? Would prevent some IF cascades. I am in doubt if it is worth implementing.
It is already implemented - the expressions are iterative, so it does not matter if you use it once or 10 times in a single statement.
It is like
foo = (..) ? x : (..) ? y : (..) ? z : -1
in C. Gets tedious, but does work and saves a LOT of "iffing".
expr ?: default
returns expr, if it is defined. It returns default, if expr is not defined Makes the following convinient: