[GAP Forum] if statement

Joe Bohanon jbohanon2 at gmail.com
Thu Jul 2 17:31:17 BST 2009


What are x and y here?  The first if statement only defines one of  
them so you might not have two comparable items stored.

To see what GAP is using for x and y, remember that you can still run  
commands in a break loop so type

x;

or

y;

in there.  As an aside, this is also a useful way to figure out what  
local variables are set to if you are running a native GAP function.   
This would be useful, for instance, if you have a computation running  
for a very long time and there is some kind of counter in the source  
code for the function.

Joe

On Jul 2, 2009, at 10:54 AM, Neha Gupta  
<neha.gupta2008 at googlemail.com> wrote:

> Dear GAP Member,
>
> I have written the following code but there is some run time error.
> The code is as follows :
>
>    if i1=1 then x:=count[1];; else y:=count[i1];; fi;
>
>    if (i1>1) then
>        if (y< x) then
>            Print("\n",count[i1],"<",count[1],"\n");
>            return elems[i1]; fi;
>    fi;
>
>    if (ctr = 1) then
>        Print ("\n We are done....\n\n\n");
>        return elems[i1];
>    fi;
>
> And the error it gives is as follows :
>
> Error, no method found! For debugging hints type ?Recovery from
> NoMethodFound
> Error, no 1st choice method found for `LT' on 2 arguments called from
> y < x called from
> <function>( <arguments> ) called from read-eval-loop
>
> Please help.
>
> Best,
> Neha
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum



More information about the Forum mailing list