[GAP Forum] an inconsistent syntax error

Anvita anvita21 at gmail.com
Wed Feb 11 08:19:23 GMT 2009


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


More information about the Forum mailing list