Detected Country () : English
Understanding Procedure And Function - codingforex.com

Welcome to CodingForex.Com!

Knowledge portal where you can learn how to create forex indicators and robot.

Click button below to choose level that suite you:

Understanding Procedure And Function

Level Newbie [2017-11-04 22:26:48] - by hillzx
Featured Image

Programming consists of instruction commands, instruction is divided into 2 ie :

  1. Procedure
  2. Function

Indeed both are instructions, look alike but not the same, Procedure is a code of directional instruction, ordered without having to know how it goes. See the picture below:

procedureilu

From the picture above looks a photo of a teacher telling her female students to open the book page 23. The disciple obediently carry out the command.

 

Now let's compare with Function, note the picture below:

 

functionilu

From the picture above looks a picture of a teacher asking something to his male students, then his students respond to questions from the teacher earlier.

In conclusion, although both provide instructions, but Function has advantages that there is a feature called "Return value".



What is Procedure and Function when written into programming code? See the example below:

 

// Procedure

void Kerja(){

Print("Lahir tahun 1985, umur anda =" + (2017-1985) );
Print("Lahir tahun 1990, umur anda =" + (2017-1990) );

}

  

// Function

void Kerja(){

Print("Lahir tahun 1985, umur anda =" + HitungUmur(1985) );
Print("Lahir tahun 1990, umur anda =" + HitungUmur(1990) );

}

int HitungUmur(int tahunLahir){
return 2017 - tahunLahir;
}

From both of the above programming examples we can see that Functions are reusable, in addition to energy savings, reusable codes also shorten the time when source code need to be revised (the effect will be global).

Well, for a while the first material introduction Procedure and Function, see you again on the next articles. Regards!



Previous Article

Featured Image

Data Type And Variable

Next Article

Featured Image

Looping




- Provided by HiLLzSoft Studio -