Functions with parameters?

Hi,

I cannot figure out how to define functions with parameters in https://makecode.mindstorms.com. Not even in the text based JavaScript tab.

Is this impossible or a good reason for this, or is it just a small fix away, since my understanding is that this is supported both in the STS language, core pxt and all other MakeCode editors?

here are no parameters in the function because the stable version of pxt-ev3 has an old editor core. In the beta version, the kernel is new and there are function parameters.

1 Like

Thanks for your quick reply which was very illuminating and helpful, @THEb0nny!

I was about to ask whether the beta version would ever be published as an updated new stable, but you already answered that here:

Don’t this work?

function myFunc(param1: number, param2: number) {
     return param1 + param2
}
1 Like

Kind of…

It “grey blocks” in the regular edition, but works in JavaScript mode:
https://makecode.mindstorms.com/#pub:_6ozEPCHk1TVA

But works in beta:
https://makecode.mindstorms.com/beta/#pub:_RD04e6e1pD6Y