I have seen this style used and ignored in (seemingly) similar situations. Here are two cases that I have seen:
myFunction = function () { // some code };
function myFunction () { // some code }
Do you need to put a ';' after functions? If so, when and why?
Thanks for the advice!
It is never required.
All ";" means is 'end of line', but most parsers assume "}" is an end of line too, so the two in conjuction is just over kill. It is technically correct to add one I guess but not necessary as far as I know.
the first one is a statement. you are creating an anonymous function:
function(){....}
and assigning it to a variable. same as if you said
x=10;
the second one is a function definition
function something(){...}
which does not technically need a semicolon.
I think it's just a convention from other languages that people use, and have included in their flashes without thinking about it twice... like you said, it works, so why bother "fixing" it...
here's an example from java:
public class Semicolon_thing { public static void main(String[] args){ int[] my_array={1,2,3,4} for(int i=0;i<my_array.length;i++){ System.out.println(my_array[i]); } } }
if I save this as Semicolon_thing.java and try to compile it in my command prompt I get:
C:\JAVA_tests>javac Semicolon_thing.java Semicolon_thing.java:3: ';' expected int[] my_array={1,2,3,4} ^ 1 error
if I add the semicolon after the array construct
public class Semicolon_thing { public static void main(String[] args){ int[] my_array={1,2,3,4} for(int i=0;i<my_array.length;i++){ System.out.println(my_array[i]); } } }
and compile....
C:\JAVA_tests>javac Semicolon_thing.java
C:\JAVA_tests>java Semicolon_thing 1 2 3 4
C:\JAVA_tests>
I think I've also seen this in special cases... anonomous constructs or something...
anyway... nothing to loose sleep over 
wow! responses from 3 of the big dogs all within 5 minutes of each other. must be my lucky day 
thank you all for your input and advice. i am glad this is not another esoteric rule within actionscript i had to keep straight.
nah.. I'm still a chiuhauha next to these guys... 
im gonna have to agree with sak.. he's a chihuahua.. so cute and fluffy. No big dogs here.. just trying to help;
/wiggles tail vigorously
here's a group of bit-101's though
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
If you write the function as the latter and then auto format your code it adds in the semicolons and that's probably why you see them for the most part.
In flash 5 switching to normal and back to expert to format your code would put it all on one line.. that was very annoying. 