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.,
if 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