Dear Forum,

I am getting a syntax error when copy-and-paste
this simple program in a newly opened GAP session.

----------------------------
q:=true;
while q do
 m:=2;
 q:=First(Primes,s->s=m)<>2;
od;
----------------------------

The error is as follows:

---------------------------------------------
gap> q:=true;
true
gap> while q do
>  m:=2;
>  q:=First(Primes,s->s=m)<>2;
Syntax error: warning: unbound global variable
 q:=First(Primes,s->s=m)<>2;
                       ^
> od;
----------------------------------------------

Yet "m" appears to be a global variable afterwards:

-------
gap> m;
2
gap>
-------

On the other hand, a similar program (in which the variable "m"
is also defined for the first time within the while loop) runs fine:

---------------
gap> q:=true;
true
gap> while q do
>  m:=2;
>  q:=m<>2;
> od;
gap>
---------------

Could this be another bug?

Anvita
_______________________________________________
Forum mailing list
[email protected]
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to