Extend your language: Difference between revisions
→{{header|langur}}
(Omit Insitux) |
Langurmonkey (talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2,007:
=={{header|langur}}==
Langur doesn't
We could use the nxor (logical equivalence) operator to test truthiness.
<syntaxhighlight lang="langur">
case true: ... # both true
case true, false: ... # first true, second false
Line 2,020:
To test directly for Boolean values (not truthiness), we could use the default == comparison.
<syntaxhighlight lang="langur">
case true: ... # both true
case true, false: ... # first true, second false
case false, true: ... # first false, second true
case null, _: ... # first null
default: ... # other
}</syntaxhighlight>
Line 3,800:
{{trans|Kotlin}}
Like Kotlin Wren does not have macros but, using a combination of chained functions and methods, it's possible (if you squint a little) to create something which closely resembles a language extension.
<syntaxhighlight lang="
construct new(cond1, cond2) {
_cond1 = cond1
|