buggie in else syntax ?

S

stef mientki

hello,

I've the idea that the "else" syntax is not always handled correctly,
or I'm overlooking something.

This pieces of code are automatic translation from another language,
sometimes it works, sometimes it doesn't ???

This piece of code works nice:

a = 2

def JSM (line_nr):
print line_nr

if a>3:
print 'asddas'
else: JSM(230) ; \ <== this is the problem line, that's ok here
print 'aaps'

While this piece of code gives a syntax error:

#Function button_antidender(bit in pin,sbyte in out
Button_Counter_Temp,byte in demp) return bit is
def button_antidender ( pin, button_counter_temp, demp ):
#serial_hw_write(counter)
Serial_HW_Write ( button_counter_temp ) ;JSM(226)
if JSM(227) and ( button_counter_temp >= 0 ):
if JSM(228) and ( pin == on ):
button_counter_temp = button_counter_temp + 1
;JSM(229)
else: JSM(230) ;
\ <=== SYNTAX ERROR
button_counter_temp = 1
;JSM(231)

Traceback (most recent call last):
File "D:\data_to_test\JALsPy\JALsPy.py", line 347, in ?
Run_JALsPy_Application ()
File "D:\data_to_test\JALsPy\JALsPy.py", line 327, in
Run_JALsPy_Application
JG.app.MainLoop()
File "D:\data_to_test\JALsPy\JALsPy.py", line 255, in MainLoop
import JAL_simulation_file
File "D:\data_to_test\JALsPy\JAL_simulation_file.py", line 265
else: JSM(230) ; \

I guess it's not the preferred syntax, but the resemblance with the
original language it optimal.
Why is it sometimes accepted an sometimes give an error message ?

thanks,
Stef Mientki
 
J

James Stroud

stef said:
hello,

I've the idea that the "else" syntax is not always handled correctly,
or I'm overlooking something.

This pieces of code are automatic translation from another language,
sometimes it works, sometimes it doesn't ???

This piece of code works nice:

a = 2

def JSM (line_nr):
print line_nr

if a>3:
print 'asddas'
else: JSM(230) ; \ <== this is the problem line, that's ok here
print 'aaps'

While this piece of code gives a syntax error:

#Function button_antidender(bit in pin,sbyte in out
Button_Counter_Temp,byte in demp) return bit is
def button_antidender ( pin, button_counter_temp, demp ):
#serial_hw_write(counter)
Serial_HW_Write ( button_counter_temp ) ;JSM(226)
if JSM(227) and ( button_counter_temp >= 0 ):
if JSM(228) and ( pin == on ):
button_counter_temp = button_counter_temp + 1
;JSM(229)
else: JSM(230) ;
\ <=== SYNTAX ERROR
button_counter_temp = 1
;JSM(231)

Traceback (most recent call last):
File "D:\data_to_test\JALsPy\JALsPy.py", line 347, in ?
Run_JALsPy_Application ()
File "D:\data_to_test\JALsPy\JALsPy.py", line 327, in
Run_JALsPy_Application
JG.app.MainLoop()
File "D:\data_to_test\JALsPy\JALsPy.py", line 255, in MainLoop
import JAL_simulation_file
File "D:\data_to_test\JALsPy\JAL_simulation_file.py", line 265
else: JSM(230) ; \

I guess it's not the preferred syntax, but the resemblance with the
original language it optimal.
Why is it sometimes accepted an sometimes give an error message ?

thanks,
Stef Mientki

Looks like you've escaped a space.


James


--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top