mercredi 2 août 2017

Inline If-Else with While-Loop

I am tryig to write an inline if statement with one line while-loop in C++ (Arduino). I tried lots of option but I can not find correct using of this using according to what I want. An examble is below about what I want to do...

if (initialize_sensor() == true) 
     while (stepper_downside()); 
else 
     while (stepper_upside());

When I wrote this code as inline,

initialize_sensor() == true ? while (stepper_downside()) : while (stepper_upside());

I get this error code "expected primary-expression before 'while'".

Aucun commentaire:

Enregistrer un commentaire