> ...may we adfirm: " A cycle, to end,
> must reach the upper limit to its maximum extreme. "
> ?
>
...I'ld like to adjust :-)
" A cycle, to end, must reach the upper value to its maximum extreme. "
Regards
vuott
-
...may we adfirm: " A cycle, to end, must reach the upper limit to its maximum
extreme. " ?
--- Dom 30/9/12, Emil Lenngren ha scritto:
> Da: Emil Lenngren
> Oggetto: Re: [Gambas-user] R: Unending cycle "For...Next" with variable As
> Byte
> A: "m
Problem with that is that the second "Print ii" statement is executed,
even if the loop is skipped (because of initial conditions). The
SuperBASIC version would print nothing if the initial loop conditions
indicate it should be skipped
The Gambas equivalent would be more like
For ii = 0 to 254
> FOR byte = 0 TO 254
> PRINT index
> NEXT index
> PRINT index
> END FOR index
>
This same thing is simpler in Gambas:
For ii = 0 to 254
Print ii
Next
Print ii
Jussi
--
Got visibility?
Most devs has no idea
It is the same in almost all languages.
unsigned char i;
for(i=0; i<255; i++){}
and
unsigned int i;
for(i=0; i<4294967295U; i++){}
in C will never terminate.
In Gambas,
Dim i As Integer
For i = 0 To 2147483647
Next
will not terminate either.
You might think that because you say the range 0 To X,
Sinclair BASIC on the QL used to have a FOR loop epilogue which could
be used to handle this sort of thing. A simple FOR loop was
FOR index = start TO stop
do some stuff
END FOR index
The NEXT control could be added to create the epilogue so:
FOR byte = 0 TO 254
PRINT index
NEXT index
Sinclair BASIC on the QL used to have a FOR loop epilogue which could
be used to handle this sort of thing. A simple FOR loop was
FOR index = start TO stop
On 30/09/2012, Jussi Lahtinen wrote:
> I think all Basics work this way!
>
> Test with any basic:
>
> For ii = 1 to 10
> Next
>
> Print ii
I think all Basics work this way!
Test with any basic:
For ii = 1 to 10
Next
Print ii
What you expect? I think all basic languages gives 11 as result.
Jussi
On Sun, Sep 30, 2012 at 10:14 PM, Kevin Fishburne <
kevinfishbu...@eightvirtues.com> wrote:
> This one bit me a while back and the
This one bit me a while back and the answer was the same and I confirmed
it through testing. Maybe the documentation for For...Next should
mention it. I suspect many BASIC dialects don't work this way, which
could lead to confusion for new users of GAMBAS. I could be wrong, but I
think even GAM
It is not bug, Richard is right.
Jussi
On Sun, Sep 30, 2012 at 6:32 PM, Tobias Boege wrote:
> On Sun, 30 Sep 2012, Ru Vuott wrote:
> > ...I have:
> >
> > [Gambas 3]
> > Version=3.3.0
> >
> >
> >
> >
> >
> > --- Dom 30/9/12, Ru Vuott ha scritto:
> >
> > > Da: Ru Vuott
> > > Oggetto: [Gambas-
On Sun, 30 Sep 2012, Ru Vuott wrote:
> ...I have:
>
> [Gambas 3]
> Version=3.3.0
>
>
>
>
>
> --- Dom 30/9/12, Ru Vuott ha scritto:
>
> > Da: Ru Vuott
> > Oggetto: [Gambas-user] Unending cycle "For...Next" with variable As Byte
> > A: gambas-user@lists.sourceforge.net
> > Data: Domenica 30
Thanks, Richard.
vuottt
--- Dom 30/9/12, RICHARD WALKER ha scritto:
> Da: RICHARD WALKER
> Oggetto: Re: [Gambas-user] R: Unending cycle "For...Next" with variable As
> Byte
> A: "mailing list for gambas users"
> Data: Domenica 30 settembre 2012, 17:11
>
Just guessing here, but valid values for Byte are 0-255. From
observation I have seen that FOR loops terminate with the loop index
at final value+1. For Byte that would probably be zero (if it just
wraps around from 255 to 0) so there is no reason to terminate the
loop.
Richard
--
...I have:
[Gambas 3]
Version=3.3.0
--- Dom 30/9/12, Ru Vuott ha scritto:
> Da: Ru Vuott
> Oggetto: [Gambas-user] Unending cycle "For...Next" with variable As Byte
> A: gambas-user@lists.sourceforge.net
> Data: Domenica 30 settembre 2012, 16:57
> Hello,
>
> maybe I'm in the clouds but
14 matches
Mail list logo