PDA

View Full Version : Making You're own function


zarfang8
02-18-2010, 09:15 PM
To sum it up: I have no idea how or why to do it.

In detail: When you go in the functions tab, and click 'create new function' It looks the same as creating a variable or parameter, you can use an object, boolean, number, or other. Then it gives you a new method that is green and a strange bar that says 'return' with the appropriate item according to what you chose after you clicked create new function. I am not sure how to use this, or how it would be helpful to me when I make something. I can't remember seeing a world where someone made there own function, so is this one of those things that doesn't really work out, like the export feature? I'm not sure, but it sounded cool, and I was wondering how to use this feature.

wongwanchap
02-18-2010, 09:27 PM
function is basically use for calculation in Alice.

Base on my testing, the running time for a same calculation in method is more than function.

So if your program need a lot of complex calculation, try to use function to do the calculation and then return it into your method.

zonedabone
02-18-2010, 10:39 PM
Zone will zone this one out!

When you create a function, the name imput is obviuosly the name, and the type is what type of data it returns! Simple enough. Once you're in the function, you can add variables and parameters as normal, and do stuff with them. The return returns that value, and ends excecution of the function. You can add more of these anywhere, and they take an imput of whatever type you set as the return value. simple enough?

zarfang8
02-19-2010, 03:38 PM
Yeah, I get. Thanks Zonedabone.