On Sun, 19 Oct 2003 13:56:19 +0100, Dilwyn Jones <[EMAIL PROTECTED]> wrote:
> $C8 is described in my book as "number of watched WHEN variables"wonderful
Ah! Jan Jones When variables - has anyone ever described thisunimplimented facility?It seems a wonderful facility. Something like:
Tony Tebby
WHEN entry=-1 PRINT"Don't enter negative numbers, mate!" RETRY END WHEN
would potentially be useful, but I don't know how it's meant to work in SBASIC. I vaguely remember back in the 1980s that very early ROMs (the first external eproms?) had a keyword called BECOMES, implying a syntax of something like WHEN var BECOMES <value> I suppose. It's obviously not in official Sinclair ROMs or anything else modern.
Actually this syntax is so COBOLesque that makes me wonder :-)
SMSQ/E at least doesn't seem to allow an entry of the example I typed above - so the syntax is definitely not WHEN var=value or WHEN var in SBASIC, I've never been able to figure out how it works if it works at all in SBASIC.
Minerva claims to be able to use it (Laurence...are you there?), here's some info from the manual:
The Minerva manual lists an example along the lines of the above:
WHEN a=6 PRINT 'a is now six' END WHEN
Single line WHEN should work, like the equivalent FOR, REPeat, IF etc.
When Variable processing can be turned off with WHEN a (that is, specifying a variable name but no value test), and WHEN anything (i.e. any name) will turn off all current WHEN processing.
It does not specify how to resume processing from such a WHEN clause, but presumably once END WHEN is reached, normal execution CONTINUEs?
End of essay :-)
Well this whole thing to me looks like a halfhouse between an IF - END IF clause (more readable at that) and a SELect ON - END SELect clause. From what I have read, WHEN allows for any kind of data type.
I don't think of it as redundant. For example (and see the COBOL reference above), I'd like to see something like COBOL 85's (Very S*Basic like btw:)
EVALUATE data-name
WHEN condition 1 (data-name = literal1 | function1-output | [{literal2} {literal-range} | {function-range output}])
Action-Block1
WHEN condition 2
Action-BLock2
WHEN other
Action-Block3
END-EVALUATE (Now that's COBOL syntax)
This has distinct advantages over the SELect ON structure as the EVALUATE statement can preset the condition up in the block header (such as: EVALUATE TRUE or EVALUATE FALSE or EVALUATE 6)
and then all the WHEN checks make sure that everything complies -or- like in the case described above you check for values in one variable only. So you can replace a whole bunch of IFs in one go and avoid condition shadowing (and unecessary typing) at the same time
Cheers,
Phoebus
-- Dilwyn Jones
--
Visit the QL-FAQ at: <http://www.dokos-gr.net/ql/faq/> (Still uploading stuff!)
Visit the uQLX-win32 homepage at: <http://www.dokos-gr.net/ql/uqlx.html>
Visit the uQLX-mac home page at:<http://www.dokos-gr.net/ql/uqlxmac.html>
