473,495 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Re: if / else statements not symmetric

Actually I think the code you have in mind is:

#1: *if (X) {A} else if (!X) {B}
#2: *the same

Anything that evaluates X more than once is not correct compilation of the code you originally gave.
Thanks for replying. I took a look at the code I had in mind, and it
was not if/elseif. However, it was a very complex piece of code,
involving evaluating a function that returns a bool [in other words if
(function_returns_bool(x,y,z)) {} else {}].

What I did was make the function return the opposite of what it was
returning, (ie. true instead of false) and the program worked
flawlessly, whereas before it was an infinite loop for the reasons I
gave in the OP.

However, I grant that perhaps this fix was due to some peculiarities
of the function, not the if/else statement, so I will retract my
original statement.

RL

Sep 8 '08 #1
1 1447
On Sep 8, 1:09*pm, raylopez99 <raylope...@yahoo.comwrote:

<snip>
However, I grant that perhaps this fix was due to some peculiarities
of the function, not the if/else statement, so I will retract my
original statement.
And the lesson is: before asserting that a language behaves oddly, try
to find a *simple* example which will demonstrate the issue. If you
manage to find a simple example, that's great and it will add weight
to your complaint. If you can't find a simple example, the problem
probably lies in your complicated code.

Jon
Sep 8 '08 #2

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

Similar topics

1
1641
by: kiran | last post by:
Hi , I need some helpon Symmetric Crptography algorithm. My friend has given a encrypted message ( encrypted using Symmetric cryptogrraphy algorithm and he does 't mention on which plat form is...
0
1213
by: Summa | last post by:
I write encrypt symmetric key using X509 Certificate public key and write to a XML file. RijndaelManaged sCipher = new RijndaelManaged(); byte EnKey = sRSA.Encrypt(sCipher.Key,false); ...
23
2753
by: bearophileHUGS | last post by:
So far in Python I've almost hated the 'else' of the 'for' loops: - I have problems to remember its meaning; - It gives me little problems when I later want to translate Python code to other...
0
152
by: =?ISO-8859-1?Q?G=F6ran_Andersson?= | last post by:
MC wrote: No, the problem is not with the compiler, but with the poster. What he describes does not happen, he just invents things like this to troll the newsgroup. -- Göran Andersson
0
7120
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,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
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...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
286
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...

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.