Page 1 of 1
for-next
Posted: Fri Sep 21, 2007 7:08 pm
by dobro
please Fred !!
a hope of several years!!
to be able to make :
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
for t.f=c.f to a step b.f
debug t
next t
WITH FOR-next not another thing!!
je prefere utiliser les boucle For-next comme dans le temps en Basic !!
vraiment si tu pouvait m'ajouter ça dans le Purebasic , pour apporter
une vraie touche basic au PureBasic

, tu ferai un heureux !!!
ps: ne me donnez pas des façon de remplacement, c'est un For-next comme citée ci-dessus que j'aimerai .. Merci
google translate
I prefer to use the For-next loop as in time in BASIC!!
really if you that in Purebasic could add me, to bring
a true key BASIC in PureBasic Very Happy, you will make happy!!!
PS: do not give me a way of replacement, it is For-next as quoted above that I will like. Thank you
Posted: Fri Sep 21, 2007 7:26 pm
by Kaeru Gaman
If this suggestion will be taken into account,
I strongly request to keep the old For/Next statement for Integers absolutely unchanged for performance reasons.
@dobro
if you wrote in english, I would've been able to understand your argument (if it is one).
Posted: Sat Sep 22, 2007 12:35 pm
by dobro
Kaeru Gaman wrote:
@dobro
if you wrote in english, I would've been able to understand your argument (if it is one).
My message was addressed has God the Father “Fred”
and this one speaks French…
I will have write in araméen if I had wanted addressed to me has other God: lol:
Re: for-next
Posted: Sat Sep 22, 2007 1:13 pm
by Dreamland Fantasy
dobro wrote:please Fred !!
a hope of several years!!
to be able to make :
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
for t.f=c.f to a step b.f
debug t
next t
I must admit I do find it slightly annoying myself when using floating points or quads since I do prefer the For...Next rather than While...Wend or Repeat...Until loops, but it isn't that difficult to recode it as:
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
t.f=c.f
While t<a
Debug t
t+b
Wend
or:
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
t.f=c.f
Repeat
Debug t
t+b
Until t>=a
Kind regards,
Francis.
Posted: Sat Sep 22, 2007 6:03 pm
by Kaeru Gaman
dobro wrote:Kaeru Gaman wrote:
@dobro
if you wrote in english, I would've been able to understand your argument (if it is one).
My message was addressed has God the Father “Fred”
and this one speaks French…
I will have write in araméen if I had wanted addressed to me has other God: lol:
so adress him in the French forums or via PM.
It's simply unpolite.
I won't write German if I want to adress Freak, either.
If you have arguments, state it to the audience, and use english to adress the audience.
Re: for-next
Posted: Sat Sep 22, 2007 6:38 pm
by dell_jockey
Dreamland Fantasy wrote:dobro wrote:please Fred !!
a hope of several years!!
to be able to make :
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
for t.f=c.f to a step b.f
debug t
next t
I must admit I do find it slightly annoying myself when using floating points or quads since I do prefer the For...Next rather than While...Wend or Repeat...Until loops, but it isn't that difficult to recode it as:
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
t.f=c.f
While t<a
Debug t
t+b
Wend
or:
Code: Select all
a.f=20.2
b.f=2.5
c.f=2.2
t.f=c.f
Repeat
Debug t
t+b
Until t>=a
Kind regards,
Francis.
These suggestions are dangerous, as fractions in PB are
not encoded as BCD, but are merely float
approximations. The result is a loop that will run most of the time, but not neccesarily each and every time...
Been there, debugged that, foolish me...

Posted: Sat Sep 22, 2007 9:11 pm
by DoubleDutch
The compiler may be able to know what type of for next to start based upon the type of numbers involved. I don't think it would need a different statement?
Re: for-next
Posted: Sat Sep 22, 2007 9:46 pm
by Dreamland Fantasy
dell_jockey wrote:These suggestions are dangerous, as fractions in PB are
not encoded as BCD, but are merely float
approximations. The result is a loop that will run most of the time, but not neccesarily each and every time...
Been there, debugged that, foolish me...

I've been there myself many a time!
If I need more precision I tend to use doubles instead of floats, but I hear what you say. I don't know of any way to avoid it.
Kind regards,
Francis.
Re: for-next
Posted: Sat Sep 22, 2007 10:17 pm
by dell_jockey
Dreamland Fantasy wrote:dell_jockey wrote:These suggestions are dangerous, as fractions in PB are
not encoded as BCD, but are merely float
approximations. The result is a loop that will run most of the time, but not neccesarily each and every time...
Been there, debugged that, foolish me...

I've been there myself many a time!
If I need more precision I tend to use doubles instead of floats, but I hear what you say. I don't know of any way to avoid it.
Kind regards,
Francis.
Francis,
if you have an integer multiplicator - one that is also the loop controlling variable, and a float value that defines the stepsize / increment per loop, you could multiply these two inside the loop and use the result for further processing. Like in:
Code: Select all
a.f
StepSize.f = 0.5
for Index=1 to 100 ; only integers or integer vars here...
a.f = Index * StepSize ; step 0.5 here
; continue using a.f for further processing
debug a.f
next Index
Posted: Sat Sep 22, 2007 10:26 pm
by Kaeru Gaman
and this will again make a float-for/next obsolete.
... I think you mean the classic precision-problem, don't you?
Code: Select all
a.f = 10000000000
Debug a
a + 2
Debug a
a + 2
Debug a
a + 2
Debug a
Posted: Sat Sep 22, 2007 10:27 pm
by dell_jockey
Kaeru Gaman wrote:and this will again make a float-for/next obsolete.
... I think you mean the classic precision-problem, don't you?
Quite so - in der Tat...
Posted: Sun Sep 23, 2007 2:41 pm
by Chris
Kaeru Gaman wrote:dobro wrote:Kaeru Gaman wrote:
@dobro
if you wrote in english, I would've been able to understand your argument (if it is one).
My message was addressed has God the Father “Fred”
and this one speaks French…
I will have write in araméen if I had wanted addressed to me has other God: lol:
so adress him in the French forums or via PM.
It's simply unpolite.
I won't write German if I want to adress Freak, either.
If you have arguments, state it to the audience, and use english to adress the audience.
Several persons who don't know French, comes on our forum, and wrote in English. They were always received correctly.
Can you to make the same thing?
Posted: Sun Sep 23, 2007 3:44 pm
by Dräc
@Kaeru Gaman
Dobro’s humour is a little bit special so don’t be surprise.
But in my point of view, his post starts in English and he suggests a translation of the French part. It is not Shakespeare-writing (true for me too) but it isn’t impolite at all.
Notice that Dobro doesn’t pollute the English forum. Moreover I find that Dobro makes more and more effort in writing English. So I encourage him to persevere!
So no matter!

Posted: Sun Sep 23, 2007 4:50 pm
by Kaeru Gaman
They were always received correctly.
Can you to make the same thing?
I just told him that I didn't understand what he wrote in french.
I appreciate that he edited in the translation.
my second answer was to his nosy remark, he adressed Fred not me.
I just said, then, if you adress Fred, adress him only and not me, too.
that's all.
It wasn't meant as an offence, though I felt a little bit offended.
on the german forums we want to recieve english writing persons well, too.
we also help french people when using a translator.
Cpl.Bator presented one of his projects there a while ago and we had no problem at all.
but I think it's still a difference between writing "the international" language in a specific forum,
and writing a specific language in the international forum.
I don't understand french or spanish or italian well enough to follow such a posting,
and I don't expect anyone to understand german well enough to let me post in german.