How to make Functions like in JavaScript

One way I find that use external events,
How can we replicate sense of using function in Gdevelop

Like we give inputs and get outputs in real functions in javascript
how to un-allocate memory of variables?

Currently, functions are not supported in HTML5, you can:
1 - Use external events as you said: Save the parameters in scene variables, call the external event (link it), in the external event use such parameter variables and save the output in new scene variables, finally you can read the return values in the output variables. But, as there is not any “local variable” related concept, forget lots of util regression calls :wink:
2 - Use JavaScript functions :laughing: … in JavaScript events, but you have to know JavaScript.

Don’t you think that it’s take lot of space in memory and slow down the game.
Can U please tell me that how to un-allocate variable space when not in use. I know about javascript garbage collector but I want to explicitly un-allocate space.
In javascript it is just assign 0 like this “x=0” how to do in gdevelop

You can’t and I think you don’t need to do that.

I think this can be achieved by setting “null” to variables in javascript condition like this…

var myVar = runtimeScene.getVariables().get(“MyVar”);

Why do you want to do that ? Does you game have optimization issue ? If no, that’s useless.

I just want to add Function behavior as in JavaScript.
Local variable creates and dies when functions ends…! just like that I want.
Not scene variables who remain live as long as scene remains live