![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
ActionScript event handlers, class definitions, and functions are grouped together into blocks with curly braces ({}
). You can put the opening brace on the same line as your declaration or on the next line, as shown in the following examples. To make your code easier to read, it's a good idea to choose one format and use it consistently.
// Event handler on(release) { myDate = new Date(); currentMonth = myDate.getMonth(); } on(release) { myDate = new Date(); currentMonth = myDate.getMonth(); } // Class class Circle(radius) { } class Square(side) { } // Function circleArea = function(radius) { return radius * radius * MATH.PI; } squareArea = function(side) { return side * side; }
You can check for matching curly braces in your scripts; see Checking syntax and punctuation.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |