Special Characters & Punctuation

GAS is a line-oriented interpreter that converts abbreviated script into grammatically correct gaseous text.  The information here describes how GAS translates the script character by character on each line.  Line length is not important, and in some cases, can be very long.  So, the editing area on the GAS window has word-wrap turned off.  If you use your own text editor, it's best to do the same.  GAS automatically performs a new line after processing each script line that generates output text.  Therefore, blank lines in the script make natural paragraph breaks.  The "Sample GAS Scripts" pull down list has several complete scripts illustrating various features.

Column 1MeaningExplanation
/Comment Comment lines simply provide documentation inside the GAS script and have no affect on the generated page.
!Style Command An exclamation mark (!) in column 1 is the first character of a style command.  Style commands control the overall appearance of the generated page, not the content.  For example: !Font and !Size control the text font in the display, and !Title sets the text shown in the browser's tab bar.
$Variable Definition User variable names begin with the $ (dollar sign) character follwed by one character.  Unless noted elsewhere, any printable ASCII character may be used for the name.  For example, $F, $3 and $- are valid variable names.  They are defined or redefined by the name beginning in column 1 followed by an = (equal sign) and function.  For example, $F = Fname stores a randomly selected Female first name in $F.  Case matters for variable names, so $v and $V are two separate variables.
Anything ElseOutput Text Anything that is not one of the above special charactes is simply interpreted as text to go to the generated page.  However, everything is interpreted character by character in the following manner.  Every letter of the alphabet will be replaced with a random phrase from a list associated with that letter.  Capital letters will have the first letter of the phrase capitalized, otherwise the phrase is all in lower case.   For example E c e. will output a random capitalized phrase from list E followed by a phrase from list C and another different random phrase from list E.  The spaces and period are output as given to form a complete sentence.  Use literals to insert text that should not be replaced with random phrases.  For example "According to $F," e c e. will have the sentence begin with some text from variable $F inserted.   Two additional characters (` grave accent) and (@ at sign) are treated like letters for random sayings and non sequiturs.  They are described in more detail in the next section.
PunctuationUsageExplanation
=Assignment The value of the function on the right is stored in the variable on the left.  For example: $L = Lname means the random Last name returned by the Lname function is stored in $L.  There are two functions (Buzz and State) that assign data to two variables at the same time.  Buzz will return a 3 word "buzz phrase" and the 3 letter acronym for that phrase. State will return a random State name and the 2 letter code for that state.
( )Parameters Left and right parentheses are required to enclose the parameters used by functions.  Parameters are separated by commas and must be given in the order defined for each function.  Some parameters are optional, but you have to provide parameters leading up to an optional parameter that you want to use.   For example, $r = Rand will default to a range of 1 to 100.  However, if you want a 3 digit number with leading zeros, you have to provide the default values like this $r = Rand(1,100,3) to be able to set the optional width.
( )Unquoted Literal There are two instances where the data between the left and right parentheses are treated like a literal, but will be processed in a special way.
1.   The Gen function processes the text as if it were going to the output page, but is instead stored in a variable.  For example, $T=Gen(N j) will store a report title in $T.  $T=Case($T,C) will capitalize the first letter of each word.
2.   The List function processes the data as Comma Separated Values to create a user-defined list of phrases that can be used to tailor the generated page.   For example, $L=(Hi,Good Morning,Hello,Aloha,Howdy) makes a list where the use of $L will randomly select one of those values.
^Escape When you need to put a special character like $ in the text, you precede it with the ^ escape character.  Otherwise it looks like the a variable to be inserted into output.  Use ^$v to see a $v in the text.  Since literals begin and end with quote marks, "use ^" for a quote inside a literal."  Use escape before $, &, #, ^ and " anywhere in the script where you want to see those characters.
&Inline Function Inline functions insert data into the text in much the same way as $ variables.  For example, $F will insert the female first name earlier saved from the Fname function.  If you use $F again, you will get the same name.  On the other hand, if you use &F in the script, GAS will randomly select a different female name each time &F is used.
#Switch Variable Switch variables are always used in pairs to turn something on and then off, in that order.  The first occurance of the # switch turns the feature on, and the second turns it off.  There are two sets of switch variables.
1.  Formatting: Switches like #b can boldface and #u can underline parts of the output.
2.  Tables: Switches #T, #R and #C are used to make tables. The first #T begins making the table, and the second #T ends the table and sends it to the output.   #R begins and ends each row that will contain one or more columns.  #C begins and end each data column. #H is a shaded #R.
" "LiteralAs mentioned above, quoted text is used when you want your actual text to go to the output without the replacement of letters with random phrases, or the insertion of variables. However, The special characters $, &, # and " still need to be escaped inside literals.  The fact that $, & and # are active inside literals is a feature that simplifies GAS script for advanced users.
`Saying The ` (grave accent) character returns a random saying. There is a matching &` inline function that will do the same but with the first letter capitalized.  For example "&F &L said ^"&`.^"" will return something like: Jackie Koinis said "What's tennis without a racket."
@non sequitur The subject matter in phrase lists A to Z are defined in the Reference Guides.  Non sequitors are phrases the have no clearly defined subjects, but still fit well in place of the A to Z phrases.  The &@ inline function will return the non sequitor with the first letter capitalized in case you want it to begin a sentence.  For example &@ c @. might return a sentence like: A decision support system adds overriding performance constraints to network readiness.
The Frequently Asked Questions (FAQ) has additional useful information.