Hello friends long time no see! I've got a really simple question this time around and I'm not sure if im just oblivous or what. The question is in regards to this do whie loop.
public class test { public static void main(String[] args) { char input, encrypted; int distance; input = In.readChar(); do { Out.println("input number between -10 and 10 without 0"); distance = In.readInt(); }while(distance < -10 || distance > 10 || distance == 0); encrypted = (char) ((input + distance % 128)); Out.println(encrypted); } }
Now If you look the text of the print statement and the while statement it (in my eyes) doesn't seem right. I'll try to explain what I see:
read in the values while the value is less than -10 or higher than ten or equal to null. Now the program works I've tested it but I obvioulsy dont have a good grasp of the do while loop (even tho I've used it before), so some explanation would be great.Thanks!