jeudi 21 mars 2019

testing same condition inside if statement in java

I want to test if a value is different than -1, I call a function each time and if I get -1 I then call the function with new parameters, mainly, I will pass 4 parameters to the function and one of them will return a value different from -1. once i get a value different from -1, i will terminate the if statements.

int value = call_function(param1)
if (value==-1)
  value=call_function(param2)
if(value==-1)
  value=call_function(param3)
if(value==-1)
  value=call_function(param4)

Aucun commentaire:

Enregistrer un commentaire