Next: 3.10 Procedures Up: 3.9 Variables Previous: 3.9.1 Setting variables

3.9.2 String variables

Special care is necessary when using strings. In order to avoid unexpected results, either a $ has to be prefixed whenever a string variable is set, or the string has to be given in quotes. Possible forms are

$name=string
name='string'
name=string variable
$name=string variable

Examples:

 string1='This is a string'  !define a string variable. Text in quotes is not
                             ! converted to upper case.
 string2=string1             !assign string variable string1 to a new variable.
 $string3=string1            !equivalent to previous case.
 $string4=mystring           !define a string variable. Since ''mystring'' is not 
                             !given in quotes, !it will be converted to upper case.
 string5=mystring            !string5 will not be a string variable since $ is missing.

yields

 SETTING STRING1        =    This is a string
 SETTING STRING2        =    This is a string
 SETTING STRING3        =    This is a string
 SETTING STRING4        =    MYSTRING
 VARIABLE MYSTRING UNDEFINED, ASSUMING 0
 SETTING STRING5        =         0.00000000

For more information concerning strings and string variables, see section 8.3



molpro@molpro.net
Sep 24, 2008