You don't need to define a variable as a numerical, character, or logical variable when you set it up. Authorware automatically interprets each variable's type based on how it is used.
When you add two variables together, for instance, Authorware treats them as numbers because arithmetic operators can be used only with numbers. When you concatenate two variables, Authorware treats them as character strings because the concatenation operator joins only strings.
Similarly, when you use a variable in a place where Authorware expects a logical variable (in the Conditional Options dialog box, for instance), Authorware treats it as a logical variable. If the variable contains a numerical value, Authorware treats the variable as TRUE when the value is anything other than 0. If the variable contains a character string, Authorware treats the variable as TRUE only if the string has the value True, T, Yes, or On (capitalization isn't important) or if it contains a nonzero numeric value. All other characters are FALSE.
Character strings must be enclosed in quotes, or Authorware will interpret the string as a custom variable.
If you use a character string (or character string variable) in a mathematical expression, Authorware interprets the variable as a numerical value. It will extract from the string all numeric digits to create a number from them. If it encounters a plus (+) or minus (-) sign or a decimal point, it will attempt to use these as part of the number. If the character string is True, T, Yes, or On, Authorware converts it to a 1; if the string contains other characters and no numbers, Authorware converts it to a 0.
If you concatenate a number (or a numerical variable) with a character string in an expression, Authorware interprets the numerical value as a character string. It converts the value to a number with up to 15 decimal places and adds the appropriate decimal separator. Separators between thousands aren't added.
RSS feed | 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_var62.htm
Comments
Amy B *TMM* said on Nov 20, 2004 at 12:06 PM :