471,330 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

buggie in else syntax ?


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\JALsPy.py", line 347, in ?
Run_JALsPy_Application ()
File "D:\data_to_test\JALsPy\JALsPy.py", line 327, in
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 ?

Stef Mientki
Aug 14 '07 #1
0 704

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jim Michaels | last post: by
7 posts views Thread by alf | last post: by
13 posts views Thread by Neal Becker | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.