ForNext "Autostep"

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Step (expression) is definitely a must have. I will try to implement it for the next version. Forget the DowTo stuff, I should be drunk ;)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

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... )
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

Fred wrote:...I should be drunk ;)
oh.. shouldn't we all!!! :mrgreen: :twisted:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

LarsG wrote:
fred wrote:...I should be drunk
oh.. shouldn't we all!!!
Pass the bottle. :)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Mmmmh, Fred; should be possible to improve a "for-next" loop just identical like is in C :?: :idea:

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. :arrow:

For <assignment[,assignment[,...]]>,<(expression)>,<instruction[,instruction[,...]]>
;code
Next

PB would continue being a BASIC.
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

Psychophanta wrote:Mmmmh, Fred; should be possible to improve a "for-next" loop just identical like is in C :?: :idea:

For <assignment[,assignment[,...]]>,<(expression)>,<instruction[,instruction[,...]]>
;code
Next
but this is not much sense (at least to me) i know a bit of c :wink:
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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

sorry, fred, synchronous posting :-)

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... )
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Plouf wrote:
(in c the while is a useless command its fuctionality can be done with for)
That's absolutely true.
And if PB include a For-Next loop as i suggested, then While-Wend should be useless in PB too :wink:

blueznl wrote:
but ehm.. while useless in c++? readability...
Readability? In C ? Are you joking? Isn't preferable ASM for readability ? :?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Readability? In C ? Are you joking? Isn't preferable ASM for readability ?
hehe. :D
Also the General Theory of Relativity.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Yeah! that astrophysic theory is cleverly posted here :!: :D
All is inside astrophysics, including all of us...
User avatar
Octopus
User
User
Posts: 55
Joined: Sat Jun 13, 2009 6:42 am
Location: Munich (Germany)
Contact:

Post by Octopus »

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.
Post Reply