How to do the DoubleDown function?

function finalValue = DoubleDown( initialValue )
% Complete the function to return twice the initialValue
finalValue = 0;
%supposed to make finalValue = 10 and then 240
end
%

댓글 수: 4

Jan
Jan 2017년 9월 16일
@Blair: "return twice the initialValue" seems to be very clear already. "twice" means "2 *". What exactly is your problem?
Blair Hall
Blair Hall 2017년 9월 16일
What do I put in to make return both numbers. I don't know if the picture is visible but there is a box under the main one shown and it says something like 'Code to Call your Function.' In the box it already has DoubleDown(5) % Change the input to DoubleDown to test other values.
DoubleDown(5) is how you call your function from the command line (or from within another function). Calling your code like this
>> DoubleDown(5)
should return
ans =
10
Presumably the second number (240) is returned when you call your function as
>> DoubleDown(120)

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

답변 (1개)

Francisco Aguiniga-Garcia
Francisco Aguiniga-Garcia 2020년 9월 29일

5 개 추천

function finalValue = DoubleDown( initialValue )
% Complete the function to return twice the initialValue
finalValue = 2*initialValue;
end
%This code worked foe me! Hope it works for you as well!

카테고리

도움말 센터File Exchange에서 Variables에 대해 자세히 알아보기

태그

질문:

2017년 9월 16일

답변:

2020년 9월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by