if......then gosub

Hi all,
I've just tried program the if....then gosub statement and the compiler keeps throwing up an error in that line of code. May be missing something simple can anyone help?. The code is:
loop:
if pin1 = 1 then gosub t1
gosub t2
goto loop
end
t1:
return
t2:
return


 
 

eclectic

Moderator
Have a look at Technical's reply in this post;

http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=5591&forum_id=28&Topic_Title=Backward%2Bcompatibility%253F&forum_title=No+new+posts+please%21+20

so, for example, this works
<code><pre><font size=2 face='Courier'>
loop1: '*********
if pin1 = 1 then gosub t1
gosub t2
goto loop1 '*******
end
t1:
return
t2:
return </font></pre></code>
e.
 
Hi e,
thanks for that, but the problem still remains for some reason. I've tried with various label names etc, and it's always the same. If I alter the code to run without the gosub e.g.(if pin1 = 1 then t1) all is ok. Any ideas?
 

hippy

Ex-Staff (retired)
That you don't get an error with the use of 'loop' as a label, and the error is in the IF-THEN-GOSUB line, It seems most likely to me that you are not using a version of the Programming Editor which supports the Enhanced Compiler, or you have not selected the Enhanced Compiler option.

Edited by - hippy on 11/12/2006 02:50:06
 
Hi Hippy,
the program was a clean install of the latest version, however I can't recall selecting the enhanced compiler version anywhere how do you do that?
 

hippy

Ex-Staff (retired)
From the Programming Editor Menu Bar, View-&gt;Options, then on the Editor tab.
 
Thanks Hippy,
Don't know if when running the program for the first time it starts up in standard mode
but mine was not set for enhanced compiler, funnily enough the reset defaults button sets it to this but i'm sure I didn't alter any defaults.
I'm sure my way of writing programs probably won,t be orthodox but this mod will make a few of my programs far easier to write and hopefully save some space too.
 
hippy,
appologies I've just now read your previous post to technical you've already realised what was happening !!!!
regards Eric
 
Top