"DEFAULT ELSE"

The documentation for the "if..else" control structure (else - Arduino Reference) makes reference to the "default else." I don't understand how to tell which else is the default. Or how to tell if one is present or not.

It's just telling you that you can use else to create a default action if none of the else if statements are true.

Just odd phrasing. I think they're intending to analogize to the switch/case statement's "default" keyword? (I recommend not using switch case - it is much easier to write bugs with switch/case). Sometimes thinking of it as a default makes a lot of sense, other times very little.

They mean that if you have an if/else if chain, if it ends with an else, that's the "default" action that is carried out if none of the conditions are true, eg:

if (x==1) {
   doStuff();
} else if (x==2) {
   doOtherStuff();
} else {  //executed if x is neither 1 nor 2, eg, what they term the "default" behavior. 
   doDefaultAction(); 
}

if (x==1) {
   doStuff();
} else if (x==2) {
   doOtherStuff();
} //if we don't need that "default" action, we don't end it with an else.

rossed:
I don’t understand how to tell which else is the default.

If you have a series of IF ELSE clauses a final ELSE will deal with everything that the others missed.

Or how to tell if one is present or not.

It will only be there if you put it there.

There is no requirement to have a default ELSE and there are situations where it is not desirable.

…R