473,809 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

buggie in else syntax ?

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_antidend er(bit in pin,sbyte in out
Button_Counter_ Temp,byte in demp) return bit is
def button_antidend er ( pin, button_counter_ temp, demp ):
#serial_hw_writ e(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_tes t\JALsPy\JALsPy .py", line 347, in ?
Run_JALsPy_Appl ication ()
File "D:\data_to_tes t\JALsPy\JALsPy .py", line 327, in
Run_JALsPy_Appl ication
JG.app.MainLoop ()
File "D:\data_to_tes t\JALsPy\JALsPy .py", line 255, in MainLoop
import JAL_simulation_ file
File "D:\data_to_tes t\JALsPy\JAL_si mulation_file.p y", 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
Aug 14 '07 #1
0 808

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2817
by: Jim Michaels | last post by:
C:\prj\quiz\withusers>php tareports.php PHP Parse error: syntax error, unexpected T_ELSE in C:\prj\quiz\withusers\tareports.php on line 205 this is the section of code. if (isset($row4)) { if (isset($row5)) { //answer given? if ($row4==$row5) {
7
3918
by: alf | last post by:
Hi, I wonder why it is an invalid syntax: File "<stdin>", line 1 if 1: if 1: if 1: print 1 or
6
6226
by: Nathan Pinno | last post by:
Why does my compiler say invalid syntax and then highlight the quotation marks in the following code: # This program is to find primes. primes = import math import gmpy while 1: run = int(raw_input("Do you want to calculate primes? 1 = yes and 2 = no. "))
0
1496
by: papafreebird | last post by:
I'm starting to code using linux codeblocks IDE and GCC compiler to create a wxwidgets gui. I have experience coding gui's in c++ builder 6 with no problems but now that I am trying to code in linux for linux I'm having issues with the syntax. What works in c++ builder doesn't work in codeblocks. the following is a c++ builder script that works for what I want. if (CheckBox14->Checked==true)
3
2855
by: sandromani | last post by:
Hi all, I am writing a webbased notepad and want to include syntax-coloring. The approach I have used is to set the font color and background color of the textarea to transparent, and place the colored text in a pre behind the text area, so far so good. The code I use for coloring is the following one: function colorize(){ var inTag=false, inAttr=false; text=textarea.text();...
13
1561
by: Neal Becker | last post by:
In hindsight, I am disappointed with the choice of conditional syntax. I know it's too late to change. The problem is y = some thing or other if x else something_else When scanning this my eye tends to see the first phrase and only later notice that it's conditioned on x (or maybe not notice at all!). Particularly if 'some thing or other' is long or complicated.
2
2247
by: klaul | last post by:
Hoping someone can help me here! I'm having some problems trying to get the right syntax for a view, and am wondering if someone could point me in the right direction! My code is currently: SELECT DISTINCT a.Department, a.Section, SUM(CASE b.Type WHEN 'T' THEN b.LYAmt ELSE 0 END) AS TLYAmt, SUM(CASE b.Type WHEN 'I' THEN b.LYAmt ELSE 0 END) AS ILYAmt,
6
7291
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable (confirmation) declared in page. Dim RsSp , SQLSp Set RsSp = Server.CreateObject("ADODB.Recordset") SQLSp = "Declare @confirm varchar(1)" SQLSp = SQLSp & "Exec SendMsg_proc "& "'" & UniCode &"' , '" & DintUserId &"' , '" & DintOrg_id &"' ,...
3
5070
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error, unexpected T_VARIABLE in /home/content/m/i/x/mixxsalon/html/FormToEmail.php on line 1 here is the code. <?php $my_email = "user@example.com"; /*
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.