Reference.Return History

Hide minor edits - Show changes to markup

June 01, 2010, at 08:51 AM by Equipo Traduccion -
Changed lines 3-6 from:

Terminate a function and return a value from a function to the calling function, if desired.

Syntax:

to:

Termina una función y devuelve un valor a la función que la llama. Puede no devolver nada.

Sintaxis

Changed lines 9-18 from:

return value; // both forms are valid

Parameters

value: any variable or constant type

Examples:

A function to compare a sensor input to a threshold [@ int checkSensor(){

to:

return valor; // ambas formas son correctas

Parámetros

valor: cualquier variable o tipo constante

Ejemplos

Una función que compara la entrada de un sensor a un umbral [@ int comprobarSensor(){

Changed lines 26-27 from:

The return keyword is handy to test a section of code without having to "comment out" large sections of possibly buggy code.

to:

La palabra clave return es útil para depurar una sección de código sin tener que comentar una gran cantidad de líneas de código posiblemente incorrecto.

Changed lines 29-30 from:

// brilliant code idea to test here

to:

// código magnífico a comprobar aquí

Changed lines 33-34 from:

// the rest of a dysfunctional sketch here // this code will never be executed

to:

// el resto del programa del que se desconfía // que nunca será ejecutado por estar detrás de return

Deleted lines 36-38:

See also

April 03, 2008, at 08:15 PM by Paul Badger -
Changed lines 9-10 from:

return value;

to:

return value; // both forms are valid

October 09, 2007, at 05:32 AM by Paul Badger -
Changed lines 18-19 from:

[@ int checkSensor(){

to:

[@ int checkSensor(){

October 09, 2007, at 05:32 AM by Paul Badger -
Deleted line 17:
July 17, 2007, at 06:28 AM by Paul Badger -
Changed lines 5-6 from:

Syntax:

to:

Syntax:

Changed lines 11-12 from:

Parameters

to:

Parameters

July 17, 2007, at 06:28 AM by Paul Badger -
Changed lines 11-12 from:

Parameters

to:

Parameters

July 17, 2007, at 06:26 AM by Paul Badger -
Added line 31:
July 17, 2007, at 06:25 AM by Paul Badger -
Changed lines 37-39 from:

}

to:

}@]

July 17, 2007, at 06:23 AM by Paul Badger -
Changed lines 42-43 from:
to:
July 17, 2007, at 06:22 AM by Paul Badger -
Changed lines 3-4 from:

Terminate a function and return a value to the calling function if desired.

to:

Terminate a function and return a value from a function to the calling function, if desired.

Changed lines 26-43 from:

}@]

to:

}@]

The return keyword is handy to test a section of code without having to "comment out" large sections of possibly buggy code.

[@void loop(){ // brilliant code idea to test here

return;

// the rest of a dysfunctional sketch here // this code will never be executed }

See also

comment?

July 17, 2007, at 06:14 AM by Paul Badger -
Added lines 1-26:

return

Terminate a function and return a value to the calling function if desired.

Syntax:

return;

return value;

Parameters

value: any variable or constant type

Examples:

A function to compare a sensor input to a threshold

 
int checkSensor(){       
    if (analogRead(0) > 400) {
        return 1;
    else{
        return 0;
    }
} 

Share