Basics Notation of Program Text

Cours Basics Notation of Program Text, tutoriel & guide de travaux pratiques en pdf.

Basics Notation of Program Text

• Upper or lowercase spelling irrelevant
– All characters of a Rexx statement will be translated into uppercase and executed
– Exception: Contents of a string remains unchanged
• Strings are delimited by apostrophes (‘) or by quotes (« ), e.g.
« Richard », ‘Richard’, « \{[]}\gulp!öäüß!{niX } »
• Multiple blank characters are reduced to one blank
– Example
saY « \{[]}\gulp!öäüß!{niX } » reverse( Abc )
becomes:
SAY « \{[]}\gulp!öäüß!{niX } » REVERSE( ABC )
HierAnIntroductionVortrags-/VorlesungstiteltoProcedural imandMasterObjecteintragen-oriented Programming (ooRexx) 1, p. 11Hier Name des Vortragenden©Profim.RonyMasterG. eintragenFlatscher
Basics Characters
• Characters outside of strings and comments must be from the following character set
– Blank
– a thru z
– A thru Z
– 0 thru 9
– Exclamation mark (!), backslash (\), question mark (?), equal sign (=), comma (,), dash/minus (-), plus (+), dot (.), Slash (/), parenthesis (()), square parentheses ([]), asterisk (*), tilde (~), semicolon (;), colon (:) and underline (_)
HierAnIntroductionVortrags-/VorlesungstiteltoProcedural imandMasterObjecteintragen-oriented Programming (ooRexx) 1, p. 12Hier Name des Vortragenden©Profim.RonyMasterG. eintragenFlatscher
Basics Variables
• Variables allow storing, changing, and retrieving strings with the help of a discretionary name called an identifier
A = « Hello, my beloved world » a= »Hello, my beloved variable »
A = a « – changed again. »
say a
Output:
Hello, my beloved variable – changed again.
• Identifiers must begin with a letter, an exclamation mark, a question mark or an underline character, followed by one or more of these characters, digits, and dots.
HierAnIntroductionVortrags-/VorlesungstiteltoProcedural imandMasterObjecteintragen-oriented Programming (ooRexx) 1, p. 13Hier Name des Vortragenden©Profim.RonyMasterG. eintragenFlatscher
Basics Constants
• Constants never get their values changed
• It is possible to use literals which are string constants appearing verbatim in an expression
– If one wishes to name constants, then there are two possibilities available
• The constant value is assigned to a variable, the value of which never gets changed in the entire program, e.g.,
Pi = 3.14159
– The constant value can be saved in the local (.local) or global (.environment) environment and will be referred to by an « environment symbol », which always start with a dot, e.g.,
.local~pi = 3.14159 /* Store value 3.14159 in .local */
say .pi /* retrieves value 3.14159 from .local*/
HierAnIntroductionVortrags-/VorlesungstiteltoProcedural imandMasterObjecteintragen-oriented Programming (ooRexx) 1, p. 14Hier Name des Vortragenden©Profim.RonyMasterG. eintragenFlatscher
Basics Comments
• Comments may be nested and are allowed to span multiple lines, e.g.
say 3 + /* This /**/ is
a /* nested
/* aha*/ comment*/ which spans
multiple lines */ 4
Output:
• Line comments: at the end of a statement, comments follow after two consecutive dashes:
say 3 + 4 –- this yields « 7 »
Output:
HierAnIntroductionVortrags-/VorlesungstiteltoProcedural imandMasterObjecteintragen-oriented Programming (ooRexx) 1, p. 15Hier Name des Vortragenden©Profim.RonyMasterG. eintragenFlatscher
Basics Statements, 1
• Statements consist of all characters up to and including the semi-colon (;)
• There may an arbitrary number of statements on a line
• If the semi-colon is missing, then the end of a statement is assumed by the end of a line
/* Convention: A comment begins in 1. line, 1. column */ SAY « Hello, my dear world »;
Output:
Hello, my dear world

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *