If and Else Statements and Operators

10.2.2008, 16:20
Submited in: Flash | Total Views: 19503

This lesson are talking about If and Else Statements. What the statements are?

A statement is an instruction you give the FLA file to do something, such as to perform a particular action.

If and Else Statements. are the most modern programming languages They help your script to make a decidion between two or more potential paths.

The if and else conditional statement lets you test a condition and then execute a block of code if that condition exists or execute an alternative block of code if the condition does not exist.

If you do not want to execute an alternative block of code, you can use the if statement without the else statement. If and Else Statements is one of the simpler theories of development that You can learn.
example 1

if (moneySaved > 500) {
buyStuff ();

// next line of action.

buyStuff function are calling only if the "moneySaved" has a better value than 500. Here is a diagram:

This diagram show us if statement one is true (money > 500) actions run and if statement one isn't truth (if they false) actions are stop.

example 2

This is another example of if - else statements:

if (money > 600) {
buyTV ("42 inch");
} else if (money > 400) {
buyTV("30 inch");

// next line of actions

Here is diagram also:

It's time for opeartor. Operators are characters that specify how to combine, compare, or change values in an expression. An expression is any statement that Flash can evaluate and that returns a value. You can create an expression by combining operator s and values or by calling a function.

That's it!

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials