Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.


11007 - The use of = and := in Authorware (24 November 1999)

by - Joseph Ganci

Be careful in the use of = (which is a relational or comparitive operator) vs. := (which is the assignment operator). Most of us know that we use a simple = sign when we are comparing two values, such as:

if a = b then...

If a = b, then the above results in the value TRUE (or 1) so that if they are true the result is:

if TRUE then...

which is equivalent to:

if 1 then...

If a does not equal b, then we get:

if FALSE then...

which is the same as:

if 0 then...

In the first two cases, what follows "then..." will be executed. In the last two, it will not be.

On the other hand, we use := when we want to assign a value to a variable:

a := b

means that the value of b is copied into the variable a (unless they are lists, but that's another story).

A lot of users get into the habit of just typing

a = b

instead of

a := b

in a Calc icon because Authorware will automatically add in the colon (:) when it notices that it is an assignment. Authorware users are saving a whopping 1/2 second by not having to type in that colon. Add that up over a lifetime and they're saving at least 5 whole minutes. Woo-hoo!

The problem is that it can be a trap to do this that can lead to a lot of lost time. For example, many know that it is possible to set up a chain like the following:

a := b := 5

In the above, both a and b get assigned a value of 5. But if I type:

a = b = 5

and close the Calc window, when I reopen it I notice:

a := b = 5 (NOTICE: no colon after the b)

Huh? Well, here's where problems arise. Authorware wasn't sure what was meant so it opted to believe that you wanted to see if b was equal to 5, then apply the result to the variable a. So the result is that whatever b's original value does not change and the value of a will be:

TRUE (or 1) if b is equal to 5
FALSE (or 0) if b is not equal to 5

So I have always made it a habit of putting in a colon when I wish it and not to include it when I don't wish it.

The opposite problem also seems to occur: Authorware users sticking in a colon where it doesn't belong:

if a := b then...

What follows the "then..." will ALWAYS happen because the value of b is assigned to a and the result of the assignment operation is always TRUE.

So there you go, don't be loose with your work. Always state what you mean. That's what we get for the ease-of-use functionality in Authorware. Since Authorware doesn't warn us, it behooves us to learn these things on our own.

There are 0 reviews
Add your review