4 ms·
Short circuiting means not evaluating the right side if the left side is sufficient - so e.g. in (Foo() OR Bar()), if Foo() returns true, it won't even evaluate
by int_19h 7y ago
Short circuiting means not evaluating the right side if the left side is sufficient - so e.g. in (Foo() OR Bar()), if Foo() returns true, it won't even evaluate Bar().
Most modern languages are like that, but BASIC is an exception to this day - even VB.NET still doesn't do short circuiting by default. You need to use special operators, AndAlso/OrElse, to get it.
Computing the line number in a GOTO is definitely an extension - the original Dartmouth BASIC never had anything like that. For jump tables and such, you were supposed to use ON..GOTO.
- ddingus 6y agoMakes perfect sense. Maybe nobody cares enough about Basic, or figures there are a zillion better performing options? Seems like an optimization like that would have been done at some point Yeah, the computed goto is odd. Back in the day, I used it and some conditional math to greatly shorten and improve performance in some programs. My first machine was only 16k. Using the graphics system in any meaningful way cost a lot in terms of program space. So, every dirty trick, including poking new addresses into string variable address pointers to overlap the graphics screen got done. Absolutely terrible code though. I am sure if I saw some of that code today, I would have a bugger of a time sorting it out.