Menu: Difference between revisions

Content added Content deleted
(added OpenEdge solution)
(Added Modula-2 code.)
Line 740: Line 740:
end
end
</lang>
</lang>

=={{header|Modula-2}}==
<lang Modula-2>MODULE Menu;

FROM InOut IMPORT WriteString, WriteCard, WriteLn, ReadCard;

CONST StringLength = 100;
MenuSize = 4;

TYPE String = ARRAY[0..StringLength-1] OF CHAR;

VAR menu : ARRAY[0..MenuSize] OF String;
selection, index : CARDINAL;

BEGIN
menu[1] := "fee fie";
menu[2] := "huff and puff";
menu[3] := "mirror mirror";
menu[4] := "tick tock";
FOR index := 1 TO HIGH(menu) DO
WriteString("[");
WriteCard( index,1);
WriteString( "] ");
WriteString( menu[index]);
WriteLn;
END;(*of FOR*)
WriteString("Choose what you want : ");
ReadCard(selection);
IF (selection <= HIGH(menu)) AND (selection > 0) THEN
WriteString("You have chosen: ");
WriteString( menu[selection]);
WriteLn;
ELSE
WriteString("Selection is out of range!");
WriteLn;
END (*of IF*)
END Menu.</lang>

=={{header|MUMPS}}==
=={{header|MUMPS}}==
<lang MUMPS>MENU(STRINGS,SEP)
<lang MUMPS>MENU(STRINGS,SEP)