Created
October 14, 2025 11:39
-
-
Save JoeGlines/e4775e30f6cd569f507ed49304c7efb6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires AutoHotkey v2.0.2+ | |
| #SingleInstance Force | |
| ; Regular function | |
| greetUser(name) { | |
| return "Hello, " . name | |
| } | |
| ; Function that takes a function as parameter | |
| applyOperation(x, y, operationFunc) { | |
| return operationFunc(x, y) | |
| } | |
| ; Call the functions | |
| message := greetUser("Alice") | |
| MsgBox(message) | |
| ; Anonymous function stored in variable | |
| addFunc := (a, b) => a + b | |
| result := applyOperation(5, 3, addFunc) | |
| MsgBox(result) ; 8 | |
| ; Inline anonymous function | |
| result2 := applyOperation(5, 3, (a, b) => a * b) | |
| MsgBox(result2) ; 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment