Decision tables: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: rewrote the REXX program for more positive logic (as opposed to negative logice), corrected a misspelling. -- ~~~~)
m (→‎{{header|REXX}}: added support for superfluous blanks in answer. -- ~~~~)
Line 801: Line 801:
* used a minimalistic way in expressing the decision table
* used a minimalistic way in expressing the decision table
* extra prompting when there was a user reponse error
* extra prompting when there was a user reponse error
* handles superfluous blanks and some punctuation.
* displaying of a countdown so user knows length of interrogation
* displaying of a countdown so user knows length of interrogation
* visual fidelity aids for postmortem analysis (as in logs)
* visual fidelity aids for postmortem analysis (as in logs)
Line 849: Line 850:
if oops then do; say; say right(howTo,79); say; oops=0; end
if oops then do; say; say right(howTo,79); say; oops=0; end
say Qprefix Q.?; parse pull x /*ask a question (after a prompt)*/
say Qprefix Q.?; parse pull x /*ask a question (after a prompt)*/
x=space(x); parse upper var x u 1 u1 2 /*u=upper(x); u1=1st char*/
x=strip(space(x),,'.'); parse upper var x u 1 u1 2 /*u1=1st char*/
if words(x)==0 then iterate /*nothing entered? Try again. */
if words(x)==0 then iterate /*nothing entered? Try again. */
if abbrev('QUIT',u,1) then exit /*the user is tired of answering.*/
if abbrev('QUIT',u,1) then exit /*the user is tired of answering.*/
if (abbrev('YES',u) | abbrev('NO',u)) & words(x)==1 then return u1
if (abbrev('YES',u) | abbrev('NO',u)) & words(x)==1 then return u1
say 'invalid response: ' x; oops=1
say 'invalid response: ' x; oops=1
Line 861: Line 862:


───────── (question 1 of 3) Does the printer not print?
───────── (question 1 of 3) Does the printer not print?
no
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
───────── (question 2 of 3) Is there a red light flashing on the printer?
No
n
───────── (question 3 of 3) Is the printer unrecognized by the software?
───────── (question 3 of 3) Is the printer unrecognized by the software?
n
n
Line 875: Line 876:
n
n
───────── (question 3 of 3) Is the printer unrecognized by the software?
───────── (question 3 of 3) Is the printer unrecognized by the software?
yes
y


Ensure printer software is installed.
Ensure printer software is installed.
Line 883: Line 884:
n
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
───────── (question 2 of 3) Is there a red light flashing on the printer?
Ye
y
───────── (question 3 of 3) Is the printer unrecognized by the software?
───────── (question 3 of 3) Is the printer unrecognized by the software?
n
n
Line 893: Line 894:
n
n
───────── (question 2 of 3) Is there a red light flashing on the printer?
───────── (question 2 of 3) Is there a red light flashing on the printer?
yes
yes.
───────── (question 3 of 3) Is the printer unrecognized by the software?
───────── (question 3 of 3) Is the printer unrecognized by the software?
yes
yes


Ensure printer software is installed.
Ensure printer software is installed.