Hi,
i noticed that there are two ways to define functions:
function hello () {
// do something
}
hello = function () {
// do something
}
which one should i use? or does it not really matter.
Hi,
i noticed that there are two ways to define functions:
function hello () {
// do something
}
hello = function () {
// do something
}
which one should i use? or does it not really matter.
nope, it doesn’t matter
although i usually define them like this:
var hello:Function = function () {
trace("hello everybody!");
};
intresting… thanks!
If you’re bored, you can check out the help file or livedocs - it recommends the
[AS]function myFunc(arg:Type):ReturnType{
//…
}[/AS]
syntax inside of class files…
function hello(){} can be called before its definition in the script.
hello = function(){} can be created in the scope of another object.
:disco:
i prefer,
function hello():Void{
trace(“Hello World!”);
}
:: Copyright KIRUPA 2024 //--