Jon Perry on Mon, 5 Aug 2002 18:02:42 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Function return value |
Why does my iscube() function: iscube(n)=local(f,retVal);f=factor(n)[,2];retVal=true;for (j=1,length(f),if (f[j]%3!=0,retVal=false));return(retVal) need to be tested with ==true? e.g: for (s=1,100,if (iscube(s)==true,print1(s,","))) works, but: for (s=1,100,if (iscube(s),print1(s,","))) doesn't, unlike the behaviour of inbuilt functions such as issquare(). Jon Perry perry@globalnet.co.uk http://www.users.globalnet.co.uk/~perry/maths BrainBench MVP for HTML and JavaScript http://www.brainbench.com