【发布时间】:2014-06-12 00:04:09
【问题描述】:
我注意到 REBOL 没有内置的 if...elsif...else 语法,就像这样:
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!"
]
我找到了一种解决方法,但它非常冗长:
theVar: 60
either 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!"
]
]
]
有没有更简洁的方法在 REBOL 中实现if...else if...else 链?
【问题讨论】:
标签: switch-statement rebol rebol3