Decision tables: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) (Added 11l) |
|||
Line 11: | Line 11: | ||
Use this [[wp:Decision_table#Example|example]] of Printer Troubleshooting given in the Wikipedia article. |
Use this [[wp:Decision_table#Example|example]] of Printer Troubleshooting given in the Wikipedia article. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Kotlin}} |
|||
<lang 11l>V conditions = [ |
|||
(‘Printer prints’ , ‘NNNNYYYY’), |
|||
(‘A red light is flashing’ , ‘YYNNYYNN’), |
|||
(‘Printer is recognized by computer’, ‘NYNYNYNY’)] |
|||
V actions = [ |
|||
(‘Check the power cable’ , ‘NNYNNNNN’), |
|||
(‘Check the printer-computer cable’ , ‘YNYNNNNN’), |
|||
(‘Ensure printer software is installed’, ‘YNYNYNYN’), |
|||
(‘Check/replace ink’ , ‘YYNNNYNN’), |
|||
(‘Check for paper jam’ , ‘NYNYNNNN’)] |
|||
V nr = conditions[0][1].len |
|||
V np = 7 |
|||
print(‘Please answer the following questions with a y or n:’) |
|||
[Bool] answers |
|||
L(condition) conditions |
|||
V inp = ‘’ |
|||
L |
|||
inp = input(‘ ’condition[0]‘ ? ’).uppercase() |
|||
I inp C (‘Y’, ‘N’) |
|||
L.break |
|||
answers.append(inp == ‘Y’) |
|||
print("\nRecommended action(s):") |
|||
L(r) 0 .< nr |
|||
L(c) 0 .< conditions.len |
|||
V yn = I answers[c] {‘Y’} E ‘N’ |
|||
I conditions[c][1][r] != yn |
|||
L.break |
|||
L.was_no_break |
|||
I r == np |
|||
print(‘ None (no problem detected)’) |
|||
E |
|||
L(action) actions |
|||
I action[1][r] == ‘Y’ |
|||
print(‘ ’action[0]) |
|||
L.break</lang> |
|||
{{out}} |
|||
<pre> |
|||
Please answer the following questions with a y or n: |
|||
Printer prints ? n |
|||
A red light is flashing ? n |
|||
Printer is recognized by computer ? n |
|||
Recommended action(s): |
|||
Check the power cable |
|||
Check the printer-computer cable |
|||
Ensure printer software is installed |
|||
</pre> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |