필터 지우기
필터 지우기

Help... what is my mistake and what should i do now?? please

조회 수: 1 (최근 30일)
Abdur Rob
Abdur Rob 2020년 9월 25일
댓글: Abdur Rob 2020년 9월 25일
function too_young = under_age(age, limit)
if age < limit
too_young = true;
else
too_young = false;
return
end
if age < 21
too_young = true;
end

채택된 답변

madhan ravi
madhan ravi 2020년 9월 25일
Since you have shown efforts:
too_young = under_age(2, []) % [] means no limit was given
function too_young = under_age(age, limit)
if isempty(limit)
limit = 21;
else
limit = limit;
end
too_young = age < limit;
end
  댓글 수: 3
madhan ravi
madhan ravi 2020년 9월 25일
function too_young = under_age(varargin)
if nargin < 2
age = varargin{1};
limit = 21;
else
age = varargin{1};
limit = varargin{2};
end
too_young = age < limit;
end
Abdur Rob
Abdur Rob 2020년 9월 25일
thank you sir for your constractive support

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by