General area when it fits no where else

Moderator: Mmiscool

User avatar
By Electroguard
#60781
beware that one thing that tripped me up was ENDIF vs END IF
for espbasic its "end if"

Esp_Basic ENDIF is shown as 2 words END IF in the examples, but they were previously stated to being equivalent (can't remember when) and the parser correctly recognises and interprets both 'endif' and 'end if' as the same.
As show in the code snippet below, because END and IF are both recognised keywords in their own right, I always specify my ENDIFs as one word to avoid mistakes or confusion.,

Code: Select allif oms="Local" then
 if instr(payload,"target=") = 0 and instr(payload,"t=") = 0 then
  target = localname
 endif
 gosub [PARSER]
else
 if oms="Serial1" then
  serialprintln payload
 else
  if oms="Serial2" then
   serial2println payload
  else
   if oms="UDP" then
    udpwrite netIP & "255", udpport, payload
   endif
  endif
 endif
endif
User avatar
By heckler
#60818 Thanks Electroguard,
I did not know that.
Possibly at the time I was having some other code issues with IF/THEN I (incorrectly) thought that it was due to my using ENDIF.

However the documentation still lists it as END IF.

thanks again for the clarification
I'll have to give ENDIF a chance :D
dwight