help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem failure file


From: Markus Mützel
Subject: Re: problem failure file
Date: Thu, 21 Feb 2019 10:55:16 +0100

On 21 Feb 2019 10:16:03 +0100 "Robert Setif" wrote:
> Here is that file with a problem I do not understand.
> 
> # dfac.m 21/2/2019  double factorial
> function r=dfac(n)
> f=1;
> if (n=0)
>   r=1;
> elseif (mod(n,2)=0)
>     for i=n:-2:2,f=f*i;,endfor
> else
> for i=1:2:n,f=f*i;,endfor
>   endif
>  r=f;
> endfunction

I am not sure what the problem is you see. But you probably want to use the 
comparison operator "==" instead of the assignment operator "=" in the 
conditions.

Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]