A primitive to check if ticks have been started

Sometimes I want to write generic sub-procedures or functions so they can be called both before and after the “reset-ticks” command. Some of these might use “ticks” but this causes an error if used before reset-ticks.

Can we have a primitive that responds with a boolean depending on whether ticks have been started or not? Something like “ticks-started?”.

thanks

This can be done as follows:

1 Like

Not sure if this was a key design decision or not, but to me it would make a lot more sense to just have ticks return -1, or maybe even 0, if the tick counter hasn’t been started yet.

It could make sense to let ticks always return a number, and then -1 would be a good candidate to indicate “not started”. But returning 0 would make “not started” and “just started” indistinguishable.

The advantage of returning -1 (or any negative number) would be that if ticks >= 0 can be used for ticks-started? with minimal overhead.

1 Like