Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
教堂有一个reverse()数组运算符,但我似乎无法让它在域上工作
reverse()
var v = {1..8}; for w in v { writeln(w); } // poops for w in reverse(v) { writeln(w); }
我该如何倒退?
您可以通过迭代v步长来完成此操作-1:
v
-1
for w in v by -1 { writeln(w); }
这些范围操作适用于范围和域。更多关于Ranges Primer的内容。