Method and Subprogramme [duplicate]
Do they both mean the same thing?
void subrotina(){};
Isn't this called a method too? People don't say they're going to do a subprogram that does something, usually people say, "I'm going to do a method that does something.".
2 answers
In Object-Oriented Programming these subprograms are called methods and can return values or not. In structured programming these subprograms are called functions when they return something and procedures when they return nothing, as is the case with this method subroutine which has the keyword void
By convention we write the name of the methods with small letter and if they are two words we use capital letter in the first letter from the second word.
Ex: getWidth ()
This writing practice is called lowerCamelCase
All the same. From wikipedia :
In different programming languages a subroutine may be called a procedure, a function, a routine, a method, or a subprogram. The generic term callable unit is sometimes used.
Translating: "in different programming languages a subroutine can be called a procedure, function, routine, method or subprogram. The generic term invocable unity is sometimes used "(free translation).