在 AutoHotKey 中编写 for 循环的最规范的方法是什么?

What is the most canonical way to write a for loop in AutoHotKey?

似乎有多种不同的方法可以在 autohotkey 中编写 for 循环。自动热键论坛 lists many different ways

考虑到我想用

复制 python for 循环中可以完成的操作
for i in range(1, 11):
    print(i)

或在 Java 中通过:

  for(int i = 1; i < 10; i++) {System.out.print(i)}

在自动热键中执行相同操作的最佳方法是什么。如果您阅读了您同事的代码,您希望他们使用哪种方式来处理从数字 1 到 10 的 for 循环示例?

在 AHK for loop is used for looping through an array 的内容 或者,更一般地,为 object.

中的每个键值对重复一个命令或一系列命令一次

在这种情况下,使用Loop和A_Index是最简单高效的方法:

; go through the numbers 1 to 10: 

Loop 10
    MsgBox %A_Index%