
ForNext "Autostep"
most basics i know simply use step with vars, i'd say keep it simple 

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Mmmmh, Fred; should be possible to improve a "for-next" loop just identical like is in C

Well, i don't say to replace the existing one, but to improve (add) a new for-next alternative. I thing this is perhaps the best point of C's power, besides of pointers, etc.
For <assignment[,assignment[,...]]>,<(expression)>,<instruction[,instruction[,...]]>
;code
Next
PB would continue being a BASIC.


Well, i don't say to replace the existing one, but to improve (add) a new for-next alternative. I thing this is perhaps the best point of C's power, besides of pointers, etc.

For <assignment[,assignment[,...]]>,<(expression)>,<instruction[,instruction[,...]]>
;code
Next
PB would continue being a BASIC.
but this is not much sense (at least to me) i know a bit of cPsychophanta wrote:Mmmmh, Fred; should be possible to improve a "for-next" loop just identical like is in C![]()
For <assignment[,assignment[,...]]>,<(expression)>,<instruction[,instruction[,...]]>
;code
Next

this can be done extremly easy with while loop
<assignment[,assignment[,...]]>
while <(expression)>
...
<instruction[,instruction[,...]]>
wend
(in c the while is a useless command its fuctionality can be done with for)
Christos
sorry, fred, synchronous posting 
but ehm.. while useless in c++? readability...

but ehm.. while useless in c++? readability...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Plouf wrote:
And if PB include a For-Next loop as i suggested, then While-Wend should be useless in PB too
blueznl wrote:
That's absolutely true.(in c the while is a useless command its fuctionality can be done with for)
And if PB include a For-Next loop as i suggested, then While-Wend should be useless in PB too

blueznl wrote:
Readability? In C ? Are you joking? Isn't preferable ASM for readability ?but ehm.. while useless in c++? readability...

- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Despite of the problem initially mentioned I nevertheless vote for having a FOR ... DOWNTO language element within PB. This is because there often are also additional tests inside a FOR ... NEXT loop against the final barrier. Thus it would help and probably speed up, if that could be done against a zero value, which often is the natural loop bottom boundary.