[Yabasic-users] Suggestions
Brought to you by:
psnake,
thomaslarsen
From: Busby, J. <jac...@ha...> - 2002-02-01 15:16:53
|
It was suggested that I post suggestions for YABASIC commands here. I hope I've got the right place. Apologies in advance if I haven't. There are two commands, both stolen wholesale from CMS REXX, which I think could be of benefit to YABASIC and hopefully shouldn't prove too difficult to add to the language: * * * * * * * * NOP NOP stands for no operation and does exactly what it says on the tin (ie. nothing) The reason for its usage to is to emphasise the fact that you are doing, thus making your code clearer. eg. if <some complicated test> = <some other complicated test> then nop else <do something about it> fi Whilst this command could be written as if <some complicated test> <> <some other complicated test> then <do something about it> fi it's not quite as clear this way. Likewise I could write, if <some complicated test> = <some other complicated test> then nop = 0 else <do something about it> fi but I shouldn't need to perform a null assignment just to achieve a null command. * * * * * * * * ITERATE The iterate command allows a for loop to break and return to the next value. This can be useful if you do not want to run through an entire loop for some reason, such as division by zero. eg. for n = -10 to 10 if n = 0 iterate x = y / n <<Lots of complicated code, that goes on for a long time>> next n Again, this could be foiled by an if...then...else construct, but the iterate command makes the code easier to read. * * * * * * * * The other thing which I'd like to see in YABASIC is reserved values for TRUE (always equal to 1) and FALSE (always equal to 0) |