You are here: Articles > Programming > Programming

 See more articles about "Programming "

Flash/Actionscript Basics: If - Then - Else Statement Syntax

 

Creating a basic if - then statement in flash or actionscript is easy. Here is the correct syntax.

The basic syntax is the following:



if (condition)

{

statement(s);

}





Here is an actual working example. If the variable userInput contains data, the value will be sent to the trace command.



if (userInput != undefined)

{

   trace("Input is " + userInput);

}



Adding an else section is not much harder:



if (userInput != undefined)

{

   trace("Input is " + userInput);

}

else

{

   trace("Input is unknown" );

}

 

Also see ...

Assembly: division
H3How to divide large numbers with assembly language, and where the results end up./H3Pnumbers are most commonly divided by smaller numbers (eg a 16 bit number divided by an 8 bit number) br / br /The numerator must be placed in specific registers and the denomenator is supplied as a singl

Assembly: Bit Shifting
H3Shift bits left or right by a desired numebr of places/H3P br / br / br /Bit shifting is an easy task. br /Shift left (in this case by 8): br /div class="code" br /shl EAX,8 br /P br /or to Shift right (in this case by 8): br /div class="code" br /

Assembly: Bit Rotating
H3Shift bits left or right by a desired numebr of places, with a wrap around to the other side/H3PThis method saves all bits. br /Say you shifted AX by 8, in either direction the new AX value would hold AH as the old AL and AL would become the old AH. This is done with a temporary copy of t

Assembly: Bit Rotating (carry flag)
H3Shift bits left or right by a desired numebr of places, with a wrap around to the other side through the carry flag/H3PThis method saves all bits. br /Say you shifted AX by 8, in either direction the new AX value would hold AH as the old AL and AL would become the old AH. br /This method

Using Ascii Text to Help Section Code
H3When coding in a plain text environment, it is difficult to set off sections and comments. The use of ascii generated text can make your life easier./H3PCoding in a plain text environment can be difficult because it is often hard to identify and set off areas of code. The generation of lar