Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is something for you. It is fairly basic (no pun intended), but it is worth looking at. I will say it is untested, so it may not work as intended. It should give you an idea on how to do things.</p> <pre><code>k$ = "" CLS ' Print the menu and get the operation to perform. WHILE k$ = "" LOCATE 8, 30 PRINT "Select an option:" PRINT LOCATE , 30 PRINT "(A)ddition" LOCATE , 30 PRINT "(S)ubtraction" LOCATE , 30 PRINT "(M)ultiplication" LOCATE , 30 PRINT "(D)ivision" PRINT LOCATE , 30 PRINT "Choice: "; ' Wait for a key press. WHILE k$ = "" k$ = INKEY$ WEND SELECT CASE k$ CASE "A", "S", "M", "D", "a", "s", "m", "d" ' Valid option entered. CASE ELSE k$ = "" LOCATE 17, 30 PRINT "Invalid choice. Try again." END SELECT WEND 'WHILE k$ = "" ' Making the choice uppercase means testing only "A" ' works instead of testing for "A" and "a". ' The same is true with the other choices. k$ = UCASE$(k$) PRINT "You selected: "; SELECT CASE k$ CASE "A": PRINT "Addition" CASE "S": PRINT "Subtraction" CASE "M": PRINT "Multiplication" CASE "D": PRINT "Division" END SELECT </code></pre> <p>Also, be careful when using <code>INKEY$</code>. Press an arrow key for example. An arrow key is an example of an extended key, and there are others too. This is why the loop is designed the way it is. <code>LEN(INKEY$) &gt; 1</code> when an extended key is pressed, unlike a letter or a number where <code>LEN(INKEY$) = 1</code>.</p> <p>If you need reference material, the wiki at <a href="http://www.qb64.net/wiki/" rel="nofollow">http://www.qb64.net/wiki/</a> should still be reliable. There is a link to an index on that page, or you can use the search box in the navigation area on the left to find what you need.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload