>I have a block and a do within the block. How can I quit the block from within
>the do (and return a seinsible value)? Do I have to do something like
The way that I have done this is to use a flag:
block([flag:false],
for ... do (
...
return(flag:true),
...
),
if flag then return(x),
...
)
If you want a value in all cases from a for loop assign it to a non
loop variable.
>How can I program this in Maxima:
> for i from j to n do if M[i][j] <> 0 then break; end if; end do;
> if i=n+1 then return 0; end if;
Use the method in the previous message:
>Do I have to do something lile i:for ... return(i)?
I dont think this will work if the loop terminates normally.
>How can I translate this Maple line into Maxima:
>a,b := b,a
If you are just trying to swap 2 variables, then
create a temp in a block, or use buildq to create a macro to
do it.
If you want to swap multiple expressions, then you can use subst.
There are some other things you can do with buildq, or the :: operator
or eval. Why dont you post more of the code?
Dan