Can Functions take List/Arrays as parameters?

In the block editor of either Arcade or Circuit Playground, I see that Functions can take parameters, but they’re Text, Boolean, or Number. I haven’t figured out if I can pass a List to a Function, but that would be SUPER USEFUL!!!

In arcade, flipping Sprite animations for left walking to right walking would be nice in arrays. Recursive functions with list inputs would be sweet for maze solvers. So many reasons.

1 Like

In the Blocks editor, that’s not currently possible. (You definitely can do that in the JavaScript editor.)

What you could do, though, is create a variable that’s used only by your function. Set that variable to an array ahead of time, and then call your function.

Just a few months ago, we had to do this for any parameter that we were passing to a function, since MakeCode Arcade only recently has allowed functions to have parameters in the Blocks editor.

This doesn’t quite work for recursive function calls, but it works for most other applications.