#include <M5Stack.h> // only necessary for my board (M5Stack)
bool condition_while = true;
bool condition_loop = true;
int condition_if = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
while (condition_while) {
if (condition_if == 0) {
Serial.println("testcase #1: if path reached");
condition_if = 1;
}
else if (condition_if == 1 ) {
Serial.println("testcase #2: if else path reached");
condition_if = 2;
}
else {
Serial.println("testcase #3: else path reached");
condition_while = false;
}
Serial.println("testcase #4: path reached inside while");
}
if (condition_loop) {
Serial.println("testcase #5: path reached outside while");
condition_loop = false;
}
}
#include <M5Stack.h> // only necessary for my board (M5Stack)
bool condition_while = true;
bool condition_loop = true;
int condition_if = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
while (condition_while) {
if (condition_if == 0) {
Serial.println("testcase #1: if path reached");
condition_if = 1;
}
else if (condition_if == 1 ) {
Serial.println("testcase #2: if else path reached");
condition_if = 2;
}
else {
Serial.println("testcase #3: else path reached");
condition_while = false;
}
Serial.println("testcase #4: path reached inside while");
}
if (condition_loop) {
Serial.println("testcase #5: path reached outside while");
condition_loop = false;
}
}