How to do the DoubleDown function?

2 visualizaciones (últimos 30 días)
Blair Hall
Blair Hall el 16 de Sept. de 2017
Respondida: Francisco Aguiniga-Garcia el 29 de Sept. de 2020
function finalValue = DoubleDown( initialValue )
% Complete the function to return twice the initialValue
finalValue = 0;
%supposed to make finalValue = 10 and then 240
end
%
  4 comentarios
Blair Hall
Blair Hall el 16 de Sept. de 2017
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.
Geoff Hayes
Geoff Hayes el 16 de Sept. de 2017
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)

Iniciar sesión para comentar.

Respuestas (1)

Francisco Aguiniga-Garcia
Francisco Aguiniga-Garcia el 29 de Sept. de 2020
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!

Categorías

Más información sobre Variables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by