Rexx Programming/How to Rexx/doublequote

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A double quote (") is a punctuation mark widely used to signal direct quotations in some written languages. In Rexx, it is used to signal string literals: values that are to be treated as is, without any computations happening inside them. In the following example, variable a will store the result of adding 3 to 5, whereas variable b will store the addition problem itself. Variable c will store the name of a certain European country.

a = "3" + "5"
b = "3 + 5"
c = "France"

The double quotes are not actually part of the string literal. They just surround the string literal so that the interpreter can recognize it. The following example would display the message "Hello world!" on the screen, but it would only display the greeting itself, not the quotation marks.

say "Hello, world!"

A string literal marked by double quotes can include apostrophes or single quote marks inside it:

say "For he's a jolly good fellow, which nobody can deny!"

Single quotes can be used to signal string literals, too, so you can use those if you'd like to include double quotes within a string literal:

say 'The cow says, "Moo!" The dog says, "Woof!"'