Menu: Difference between revisions
Content deleted Content added
Added BBC BASIC |
|||
Line 194: | Line 194: | ||
sel$ = ret$ |
sel$ = ret$ |
||
end function</lang> |
end function</lang> |
||
=={{header|BBC BASIC}}== |
|||
<lang bbcbasic> DIM list$(4) |
|||
list$() = "fee fie", "huff and puff", "mirror mirror", "tick tock" |
|||
selected$ = FNmenu(list$(), "Please make a selection: ") |
|||
PRINT selected$ |
|||
END |
|||
DEF FNmenu(list$(), prompt$) |
|||
LOCAL index%, select$ |
|||
IF SUM(list$()) = "" THEN = "" |
|||
REPEAT |
|||
CLS |
|||
FOR index% = 0 TO DIM(list$() ,1) |
|||
IF list$(index%)<>"" PRINT ; index% ":", list$(index%) |
|||
NEXT |
|||
PRINT prompt$ ; |
|||
INPUT "" select$ |
|||
index% = VAL(select$) |
|||
IF select$<>STR$(index%) index% = -1 |
|||
IF index%>=0 IF index%<=DIM(list$() ,1) IF list$(index%)="" index% = -1 |
|||
UNTIL index%>=0 AND index%<=DIM(list$(), 1) |
|||
= list$(index%)</lang> |
|||
Empty entries in the list are not offered as options, nor accepted as a selection. |
|||
=={{header|Brat}}== |
=={{header|Brat}}== |