A method only tells a program how to do something


Q - Why is a function required to have a return statement whereas a method doesn't have a return statement?

A - A method only tells a program how to do something, move, turn, roll, point, orient etc. It does not have values that it creates. Whereas, a function creates some type of value, a number, a result of true or false (Boolean), or other property of an object. This value that is created, calculated, chosen or by other means needs to used by the program. Without the 'return' statement that value just sits there. In other words the function returns it to the program for it to be used. A good example would be a team project. If one member was asked to complete part of the project but does not return it to the team, how will the rest of the project be completed. 

Criteria - Respond to the answer above by adding more information to your response or indicate that you disagree with anything that was said and why. Write one paragraph with at least 3 sentences.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: A method only tells a program how to do something
Reference No:- TGS0130881

Expected delivery within 24 Hours