1

What is the difference between the following two function definitions in ActionScript 3?

f = function(arg) {
  // body
}

and

function f(arg) {
  // body
}
Tim
  • 13,904
  • 10
  • 69
  • 101

1 Answers1

3

There is very little practical difference in the example you have provided. The difference is really at compile time. The one worth noting is that that in first case, f = function, you can redefine the value of f at anytime, while in the second case, redefining f would cause a compiler error.

General best practices is to use the second.

Hope that helps.

Tyler Egeto
  • 5,505
  • 3
  • 21
  • 29
  • 1
    Thanks. I'll add that `f` can only be called after the declaration in the first, but in the whole scope in the latter. – Tim Jul 13 '11 at 08:29