Home » » Function Basics

Function Basics

Written By Unknown on Minggu, 22 Januari 2012 | 00.04

Lab RPL .
By it's definitoin , a function is a group of code that is accessed at some point in the execution of a program which carriec out some specific task(s). They are accessed when they are called . Below is how a function would look ;
type name ( type parameter1, tyoe parameter2, . . . ){
                  // code here

where type is the Return type of the function, name is the appropriate name given to the function and each parameter (argument) is of an appropriate type.
By definition, a function can return a value of a certain type to where the function was callead. Just like variables, a function can be of type int , float , long , etc . .
However, there is a spesial type of function type called void .

By definition, a void function Does Not Return a Value. Mostly, void functions are used when printing something to the screen such as a welcome message or even the triangle of stars.

0 komentar:

Posting Komentar