Check out example codes for "expected unqualified-id before 'if'". It will help you in understanding the concepts better.

Code Example 1

void loop(){

if(distanceCm < 21){
  digitalWrite(13, HIGH);
}
else{
  digitalWrite(13, LOW);
}
}

Learn ReactJs, React Native from akashmittal.com