edumatos / multiplayer-asteroids

Automatically exported from code.google.com/p/multiplayer-asteroids
0 stars 0 forks source link

Question about coding syntax, semantics #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Aloha, just curious about the use of semi-colins as terminators in this 
project.  It would appear, some lines end with ';' and others don't.

Just as a quick example, here is small excerpt of code from Flash/XPBar.as:
        public override function set width(w:Number):void{
            componentWidth = w;
            overlay.width = w;
            bar.width = w
            xptext.x = w/2 - xptext.width/2

            bar.width = w*(xp/level)
        }   

I note that 
overlay.width = w;
bar.width = w 

I have read that the flash compiler is a little lax when it comes to 
terminators, usually the carriage return is enough.  

Why do some lines end with ; and others don't?

Original issue reported on code.google.com by h3liumdr...@gmail.com on 20 Sep 2010 at 8:44

GoogleCodeExporter commented 9 years ago
To answer my own question in the broad scope,

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e
63e3d118a9b90204-7f9b.html

Semicolons

You can use the semicolon character ( ; ) to terminate a statement. 
Alternatively, if you omit the semicolon character, the compiler will assume 
that each line of code represents a single statement. Because many programmers 
are accustomed to using the semicolon to denote the end of a statement, your 
code may be easier to read if you consistently use semicolons to terminate your 
statements.

Using a semicolon to terminate a statement allows you to place more than one 
statement on a single line, but this may make your code more difficult to read.

Original comment by h3liumdr...@gmail.com on 20 Sep 2010 at 8:52