Getting the syntax right

A function will work right only if you use the correct syntax. The syntax of a function includes the function's arguments. Almost every system function requires arguments, which supply the function with the information it needs to carry out its task. For example, when you use the SQRT function, you need to supply the function with the number you want the square root of.

The most detailed description of a function's syntax appears in System Functions. Authorware also displays the syntax of each function in the first line of the description in the Functions dialog box.

There are two types of arguments: required and optional. Optional arguments are enclosed in brackets ([ ]). Not every function has optional arguments.

The best way to get the syntax right is to select a function in the Functions dialog box and then paste where you want to use it. Then replace the argument names in the template syntax with the values you actually want to use. For example, if you want to make sure that the name you're storing in the variable UserName is capitalized, first type:

UserName :=

Then paste in the Capitalize function, like this:

UserName := Capitalize(string [,1])

Replace string with the name of the variable that contains the text the user has entered:

UserName := Capitalize(EntryText [,1])

And finally, delete the optional argument:

UserName := Capitalize(EntryText)

If you are entering a function or variable in a Calculation window, you can make sure that the capitalization is correct for case-sensitive functions by setting the properties in the Calculation window to automatically correct the system functions and variables case. This is normally not necessary, however. When you close the calcluation icon, the next time you open it, you will see the correct case. For details, see Changing calculation defaults in the Calculation window.

Using a system function

To use a system function:

  1. Select where you want to use the function:
  2. Select Window > Functions.
  3. From the Category drop-down list, select the category that contains the function you want to use.

    If you don't know which category the function is in, select All.

  4. Select the function from the list, and then click Paste.
  5. In the parentheses following the function's name, insert any information the function may require.

    The syntax and arguments for each system function are listed and defined in the Functions dialog box.

See also

System functions


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/authorware/7/using_aw_en/09_var37.htm