I want to write a simple program that check number of conditions and stop if some of them is wrong. I have everything in setup() and tried to use exit() for this but it does not work. I cannot return() either because setup() is void and it must be void. Is there a way to avoid using a lot of nested ifs? Example:
if (Serial.list().length>0) Arduino = new Serial(this,Serial.list()[0],115200);
else {
println("Arduino not connected");
exit();
}
//do some stuff here
if (AnotherCheckFail==true) exit();
//another stuff