If ... Then Gosub <> If ... Then Goto?
Newbie question once more.. Why cannot I write like:
LCD_Present VAR PORTA.0
IF LCD_Present Gosub LCD_Subroutine : ENDIF
_____________^^^
I know I can do it by:
IF LCD_Present=1 THEN
Gosub LCD_Subroutine
ENDIF
But it is two extra lines in code.. IMHO
Does it have to be If..Then goto (label)
/MRa
reducing line count by single line if..then..gosub..:endif
Quote:
Originally Posted by Archilochus
... oopps didn't realize that you were asking about gosub - not goto!
What if you used the IF-THEN-GOTO, and after the code at the GOTO label you used another GOTO to come back where you were? I guess you'd still have to type the extra lines though.
EndEDIT
Yep, that's the point (gosub). Since lcd-routines are so SLOW, I would like to use lcd only for diagnostic purposes, when the speed is not so important. There would be no way to know where to return, since there would be 10's of possible (unlabeled) places where the lcd-subroutine needs to be called from.. Of course I could (and maybe I should) use another PIC for communicating and buffering dataIO with outside world (and LCD)...
I dunno - should I put this If..then..Gosub..:Endif into wish-list or not.. It does not matter if you have less than hundred lines of code, but when the line count is more than few hundreds, one starts to write the code in such way it would be as easy to "read" afterwards as possible..
What do ya say folks?
/MRa