Quantcast
Channel: If...else if...else in REBOL - Stack Overflow
Viewing all articles
Browse latest Browse all 4

If...else if...else in REBOL

$
0
0

I've noticed that REBOL doesn't have a built in if...elsif...else syntax, like this one:

theVar: 60{This won't work}if theVar > 60 [    print "Greater than 60!"]elsif theVar == 3 [    print "It's 3!"]elsif theVar < 3 [    print "It's less than 3!"]else [    print "It's something else!"]

I have found a workaround, but it's extremely verbose:

theVar: 60either theVar > 60 [     print "Greater than 60!" ][        either theVar == 3 [            print "It's 3!"        ][            either theVar < 3 [                print "It's less than 3!"            ][                print "It's something else!"            ]        ] ]

Is there a more concise way to implement an if...else if...else chain in REBOL?


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>