Is it possible to have several return statements in a function? Does a return statement have to return a value? Explain both answers.
What will be an ideal response?
Yes it is possible to have several return statements in a function. You could have returns nested inside switch case statements or if/else if statements. The return does not have to return a value. If the function return type is void, you’d just use “return ;” to exit the function. If the function has a void return type, and program control flows to the “bottom” of the function, no return is needed.
You might also like to view...
Which of the following is NOT a way to remove panes from a window that has been split?
A) Double-click the split bar B) Click Split in the Window group C) Drag a vertical split bar to the left or right edge of the worksheet window D) Click Remove Split in the View tab
Tabs are
a. an effective device for Web site navigation. b. overused. c. a navigation metaphor that few people understand. d. best if they’re all the same color.