[Top][All Lists]

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

Re: problems

From: fbarbuto
Subject: Re: problems
Date: Thu, 1 Oct 2015 12:20:10 -0700 (PDT)

Hi Robert,

You might write your function hyp() like this:

function r = hyp(x=0,y=0)
  r = sqrt(x*x + y*y);

That would prevent execution errors should you pass no arguments to it
(which would be a bit of a
nonsense, though):

>> hyp
ans = 0
>> hyp()
ans = 0

But it would work fine with some arguments:

>> hyp(3)
ans =  3

>> hyp(4)
ans =  4

>> hyp(3,4)
ans =  5



View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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