SigmundAI Copilot allows you to build and debug experiments with help from artificial intelligence. Install the Sigmund extension (public beta) and try it out now!
类似 Python 的迭代器 (Pythonic)
pythonic
库提供了类似Python的函数,用于遍历数组。可用的函数有:range()
、enumerate()
、items()
、zip()
和 zipLongest()
。
示例:
绘制一个五行五列的递增数字网格:
let positions = xy_grid(5, 50)
const cnv = Canvas()
for (const [i, [x, y]] of enumerate(positions)) {
cnv.text({text: i, x: x, y: y})
}
cnv.show()
概述请参见: