Useful Programming Trick .. But 40 years late!
|
01-18-2016, 04:31 PM
Post: #1
|
|||
|
|||
Useful Programming Trick .. But 40 years late!
If you still tinker with legacy BASIC (like the one used on the series 80 HP desktop machines) or the hP-71B and the HP-75C, like I still do, then I have a programming trick for you, especially if you dislike the lack of structured IF-THEN-ELSE constructs that don't need line numbers (like the Paris-group BASIC extensions to the HP-71B). You can use the FOR loop to emulate the THEN and the ELSE clauses as follows:
Code: IF condition THEN L=1 ELSE L=0 You can replace the variables L and I with any other variable names support by the BASIC interpreter you are working with. Here is an example using the HP-71B: Code: 10 X=RND The above trick is handy if you are coding a short example on the fly and don't want to be bothered with line numbers (or labels in the case of the HP-71B). Enjoy the very belated programming trick! Namir |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)