returnStructureWeb & Application
int val = 30;
void draw() {
int t = timestwo(val);
println(t);
}
int timestwo(int doubledVal) {
doubledVal = doubledVal * 2;
return doubledVal;
}
int[] vals = {10, 20, 30};
void draw() {
int[] t = timestwo(vals);
println(t);
}
int[] timestwo(int[] doubledVals) {
for(int i=0; i<b.length; i++) {
b[i] = b[i] * 2;
}
return doubledVals;
}
Keyword used to indicate the value to return from a function. The value being returned must be the same datatype as defined in the function declaration. Functions declared with void can't return values and shouldn't include a return value. Functions can't include more than one return and the statement including return must be the last line in the function.
typefunction {
statements
return value
}
boolean, byte, char, int, float, String, boolean[], byte[], char[], int[], float[], String[]any function that is being definedany valid statementsmust be the same datatype as the type parameter1.0KeywordPDE