Sent from Yahoo Mail on Android 
 
  On Sun, 21 Jun 2020 at 21:04, 
ql-users-requ...@lists.q-v-d.com<ql-users-requ...@lists.q-v-d.com> wrote:   
Send Ql-Users mailing list submissions to
    ql-users@lists.q-v-d.com

To subscribe or unsubscribe via the World Wide Web, visit
    http://lists.q-v-d.com/listinfo.cgi/ql-users-q-v-d.com
or, via email, send a message with subject or body 'help' to
    ql-users-requ...@lists.q-v-d.com

You can reach the person managing the list at
    ql-users-ow...@lists.q-v-d.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ql-Users digest..."


Today's Topics:

  1. Re: Select on (Michael Bulford)


----------------------------------------------------------------------

Message: 1
Date: Sun, 21 Jun 2020 19:53:50 +0000 (UTC)
From: Michael Bulford <michaelbulf...@yahoo.co.uk>
To: ql-users@lists.q-v-d.com
Subject: Re: [Ql-Users] Select on
Message-ID: <1003333179.2817707.1592769230...@mail.yahoo.com>
Content-Type: text/plain; charset=UTF-8

 If we are talking about Selecting on single-character strings, such as when 
coding actions depending on some keypress, I would like to tell you about how I 
get around this problem.? At the very beginning, I would declare some constants 
of the codes of all the alphabetical characters, all 52 of them.? Underscores 
are used in the names to highlight these vars are constants and their initial 
values should not change.? I will give what the code would look like under 
Minerva, and then how this would look in SMSQ/E. Note that when Selecting on 
strings, both cases, capitals and lower case letters are considered 
equivalent.? This has to be taken into account.

100 :?
110 :120 REMark In Minerva SuperBASIC130 case$ = "" : REMark "a" == "A" - both 
cases140 SELect ON case$150 = "a" : PRINT 'Choice is "A"'160 = "b" : PRINT 
'Choice is "B"'170 = "c" : PRINT 'Choice is "C"'180 = "d" : PRINT 'Choice is 
"D"'190 = "e" : PRINT 'Choice is "E"'200 = "f" : PRINT 'Choice is "F"'210 = 
CHR$(27) : PRINT 'Esc pressed'220 END SELect230 :
2000 REMark In SMSQ/E S*BASIC2010 REMark Note: MANIFEST is optional TURBO 
command for extra constant checking2020 :2030 MANIFEST : _a =? 97 : A_ = 652040 
MANIFEST : _b =? 98 : B_ = 662050 MANIFEST : _c =? 99 : C_ = 672060 MANIFEST : 
_d = 100 : D_ = 682070 MANIFEST : _e = 101 : E_ = 692080 MANIFEST : _f = 102 : 
F_ = 702090 MANIFEST : ENTER = 10 : Esc = 272100 CLS2110 REPeat loop2120 PRINT 
'Choose case: Press a letter between "a" and "F" ';2130 case = 
CODE(INKEY$(#1,-1)) : IF case <> ENTER : PRINT CHR$(case); " ";2140 SELect ON 
case2150 = _a,A_ : PRINT 'Choice is "A"'2160 = _b,B_ : PRINT 'Choice is 
"B"'2170 = _c,C_ : PRINT 'Choice is "C"'2180 = _d,D_ : PRINT 'Choice is 
"D"'2190 = _e,E_ : PRINT 'Choice is "E"'2200 = _f,F_ : PRINT 'Choice is 
"F"'2210 = Esc? ?: PRINT 'Esc pressed' : EXIT loop2220 = REMAINDER : PRINT 'Try 
again'2230 END SELect2240 END REPeat loop2250 PRINT 'Test complete'2260 PRINT 
#0,'Test complete'

Michael


------------------------------

Subject: Digest Footer

_______________________________________________
QL-Users mailing list


------------------------------

End of Ql-Users Digest, Vol 196, Issue 7
****************************************

Think this is a tidied/readable version..  
_______________________________________________
QL-Users Mailing List

Reply via email to