Note: You must press "YES" when it says the variable is unset
Code: Select all
#Requires AutoHotkey v2.0-a128
#singleinstance force
nat() {
; Constants
start := 1
enumerate(&n) {
MsgBox "Sent by user: " n
n := start ; yield statement
start += 1 ; do block
return True ; continue?
}
return enumerate
}
for n in nat() {
MsgBox "Received from coroutine: " n
n := A_Index * 2
}
Some helpful links:
Download link to a128 - https://www.autohotkey.com/download/2.0/AutoHotkey_2.0-a128-f63b0eb4.zip
An explanation of python's generator.send() - https://stackoverflow.com/a/19302700
EDIT: The exact version in which it was removed was beta.4, confirmed working on beta.3
beta 3 - https://www.autohotkey.com/download/2.0/AutoHotkey_2.0-beta.3.zip
beta 4 - https://www.autohotkey.com/download/2.0/AutoHotkey_2.0-beta.4.zip
beta.4 changelog - viewtopic.php?f=24&p=485902#p466061