realbasic-nug
[Top] [All Lists]

Re: Elseif problem?

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Elseif problem?
From: Christian Dorn <realbasic@online.de>
Date: Tue, 30 Jun 2009 22:57:43 +0200
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <C670434D.57979%markus_winter@online.de>
References: <C670434D.57979%markus_winter@online.de>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

Am 30.06.2009 um 22:33 schrieb Markus Winter:

Hi,

I have the following code which jumps over the elseif statement straight into the second loop but does not execute it - with CB_Numeric checked,
StartValue = 10, EndValue = 5, and StepValue = -1 :

No, there is no bug. We've had a discussion about for-loops a while back here. Basically a negative step value reverses the 'to' and the 'downto' keywords.


So the two for-loops are the same:

          for i = 10 to 5 step -1
          for i = 10 downto 5 step 1

As are these two:

          for i = 5 to 10 step 1
          for i = 5 downto 10 step -1


So the second for-loop in your example translates to:

          for i = 10 to 5 step 1

And of course the debugger will not enter the loop, because the start value is already bigger than the end value.

Gruß
Christian

----------------------------------------
Christian Dorn
realbasic {a} online.de

REALbasic 2008.5-1 Pro
REALbasic 2009.2-1 Studio
iMac 3.06 GHz Intel Core 2 Duo, 4 GB RAM
PowerMac G5 2x2GHz, 1.5 GB RAM
Mac OS X 10.5.6
----------------------------------------






_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>