Thursday, April 9, 2009

Are the parentheses in a return statement mandatory?

Answer: No. The formal syntax of a return statement is

return expression ;

But it's legal to put parentheses around any expression, of course, whether they're needed or not.

No comments: