Hi!
There are two kinds of loop with any step you like.
They are while and repeat.
So we don't have to mess Pascal with any C syntax.
Keep it simple!
Winni
I very much agree that things should be kept simple. But almost any language I know of has at least two or even three different loop statements adding more keywords and rules to a language (= not simple). I must admit that when designing a new language it is very tempting to copy existing constructs rather than to break away from tradition and do one's own thinking. Of course, this does not apply to FreePascal or any other language set about to maintain compatibility.
In the last couple of months I've been struggling with loop constructs and the idea was quickly born to have just one loop flexible enough to cover everything. This morning I
might have succeeded in doing just that. Amazingly, it cuts out quite some compiler code and complexity (especially when supporting jumps) while providing a very flexible loop construct. For those interested, here are a few examples:
https://sharpbasic.com/forum/viewtopic.php?t=40I agree with 440bx that a for-loop -- IF implemented (with or without a
step or
by clause) -- should maintain its traditional form. My attempts to redesign it never gave a truly satisfying result, until the introduction of well-designed shortcut operators, which can be applied consistently in a language.