I want to know what is the best way to stop infinite loop (Note: I need infinite loop in my code but I can't stop it)
Thank you
Person
boolean flag2 = true;
boolean Flag3=true;
while (flag2) {
arr =getarray(arr);
try {
resultarr = Translate(scale, Xrotat, Yrotat, Zrotat, arr);
} catch (IOException e) {
e.printStackTrace();
}
float Z_wrist = arr[6];
float Z_Elbow = arr[7];
if ((resultarr[0] != 0) && (resultarr[1] != 0)
&& (resultarr[2] != 0)) {
String data2 = resultarr[0] + " " + resultarr[1] + " "
+ resultarr[2] + " MOVETO";
System.out.println(data2);
if ((Z_wrist > Z_Elbow)&&(Flag3==false)) {
System.out.println("GRIP" );
Flag3=true;
} else if((Z_wrist<Z_Elbow)&&(Flag3==true)) {
System.out.println("UNGRIP\r\n");
Flag3=false;
} {
System.out.println("UNGRIP");
Flag3=false;
}
}
}

New Topic/Question
Reply




MultiQuote





|