Detected Country () : English
Logic - 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:

Logic

Level Newbie [2017-11-05 08:34:57] - by hillzx
Featured Image

The condition of the parable is a condition where a programmer is faced with choice, the choice will lead to more than one decision option.

If TRUE then ... If WRONG then ... note the picture below:

if else bagan

When poured into the programming code will be like this:

 

if (something==true){ // Jika sesuatu itu BENAR maka lakukan proses 1
   process1();
} else { // Apabila SALAH lakukan proses 2
   process2();
}



Please note, the sign = (equal to) is written twice.

Here are the other variants:

 

// Contoh A : Sama dengan 10
if (something==10){
   process();
}

------------------------------

// Contoh B : Tidak sama dengan 10
if (something!=10){
   process();
}


------------------------------

// Contoh C : Lebih dari sama dengan 10
if (something>=10){
   process();
}

------------------------------

// Contoh D : Kurang dari sama dengan 10
if (something<=10){
   process();
}



OK, we try another example, we make a case example of student exam assessment:

  1. If the value is 90 or more then the student gets A rank
  2. If the value is between 80 s / d 89 then the student gets B ranking
  3. If the value between 70 s / d 79 then the students get the rank C
  4. If the value between 60 s / d 69 then the student gets D ranking
  5. If the value is less than 60 then the students get the E rank

 

void Kerjakan(){
Print(KonversiNilaiMenjadiRangking("Dono",98);
Print(KonversiNilaiMenjadiRangking("Kasino",77);
Print(KonversiNilaiMenjadiRangking("Indro",45);
}


string KonversiNilaiMenjadiRangking(string nama, int nilai){
 if (nilai>=90){
   return nama + " dapat rangking A";
 } else if (nilai>=80){
   return nama + " dapat rangking B";
 } else if (nilai>=70){
   return nama + " dapat rangking C";
 } else if (nilai>=60){
   return nama + " dapat rangking D";
 } else if (nilai<60){
   return nama + " dapat rangking E";
 }
}


---------------------------------------

//Hasilnya
Dono dapat rangking A
Kasino dapat rangking C
Indro dapat rangking E

Good luck, do not forget to share and follow our official facebook and youtube, happy trading!



Previous Article

Featured Image

Looping

Next Article

Featured Image

Meta Editor




- Provided by HiLLzSoft Studio -