By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

buggie in else syntax ?

P: n/a

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 ( 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
else: JSM(230) ;
button_counter_temp = 1

Traceback (most recent call last):
File "D:\data_to_test\JALsPy\", line 347, in ?
Run_JALsPy_Application ()
File "D:\data_to_test\JALsPy\", line 327, in
File "D:\data_to_test\JALsPy\", line 255, in MainLoop
import JAL_simulation_file
File "D:\data_to_test\JALsPy\ ", 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 ?

Stef Mientki
Aug 14 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.