|
A return operator terminates the current function execution and returns
the control to the calling program. A return(expression); operator terminates
the current function execution with result transmission. The operator expression
must be enclosed in parentheses and should not contain an assignment operator.
return処理は、関数の実行を終了し、呼び出したプログラムにコントロールを返します。return(expression); 処理は現在の関数を終了させると共に、実行結果を送ります。処理の
expression は、丸括弧で囲む必要があり、代入演算子を含めることは出来ません。
Examples:
例:
int CalcSum(int x, int y)
{
return(x+y);
}
In functions with the value of void type to be returned, the return operator must be used without the expression:
戻り値が void型の値を持つ関数では、return処理のexpression部分は省く必要があります。
void SomeFunction()
{
Print("Hello!");
return; // this operator can be deleted
}
The right brace of the function means implicit execution of the return
operator without expression.
関数の右の中括弧は、return処理に expression 無しでの暗黙の実行を意味します。
|