哪些语言(如果有)支持语法:
a < b < c
其中评估为"a
小于b
和b
小于c
"?
为什么这么多语言没有此功能?
巨蟒绝对是其中之一! 并根据https://til.hashrocket.com/posts/tceb6f2vxe-interval-comparison-in-javascript 参见How do I check whether an int is between the two numbers?=>这称为"区间比较"。 另请参阅Why are interval comparisons (e.g: x < variable < y) not supported in most "mainstream" languages?