Allow fat arrow functions to define function Topic is solved

Propose new features and changes
sf135
Posts: 4
Joined: 04 Oct 2023, 03:40

Allow fat arrow functions to define function

Post by sf135 » 04 Oct 2023, 04:28

At the moment, fat arrow functions in AHK only accept expressions. In JavaScript, if the right-hand side starts with {, it's interpreted as a function body, allowing you to define a function on the spot. It would be nice if AHK supported this capability of defining functions using fat arrow functions.

Code: Select all

; At the moment, this is not possible, but it would be nice if we could write like this:
fn := (v) => {
  ; function body
  ; multiple sentences allowed
}

geek
Posts: 1055
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Allow fat arrow functions to define function  Topic is solved

Post by geek » 04 Oct 2023, 06:16

This functionality has already been implemented and is available in the open alpha of AutoHotkey v2.1: https://www.autohotkey.com/docs/alpha/Functions.htm#funcexpr

Available for download here: https://www.autohotkey.com/download/2.1/

sf135
Posts: 4
Joined: 04 Oct 2023, 03:40

Re: Allow fat arrow functions to define function

Post by sf135 » 04 Oct 2023, 15:20

Oh, this functionality was added just a few days ago! Thank you!

Post Reply

Return to “Wish List”