| To: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
|---|---|
| Subject: | Re: Why is this not incrementing? |
| From: | Carlos M <rblists@rbtips.com> |
| Date: | Wed, 1 Jul 2009 05:00:35 +0100 |
| 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; dkim=neutral (body hash did not verify) header.i=@gmail.com |
| Delivered-to: | listarchive@realsoftware.com |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=Oz4EuJTiQhRwrv+/wOtNuRB7cAeT1fKa31G8iMkLkww=; b=Icrl05SIlBp5ER0ldRHfNz7mlWCprSG78sxfblneLzVcCfupC1yo7ZscVtt0k3fYhf LCHx6MLn6b5/brv4nGTKm1NLjuFBkbQaTcGi9W9/PJHZOOFbyHEGV34BhK/P66+EzttV 7atgDxIcMdBmXQSCazEamBXNWIEqk6LBHT0cE= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=JCcD6F6eoLd7sXJ8IyHFUxsCkPtjDG3yKWsXsuxx3MgiesvOJDhNLOuJw7tB+n0O9c LYbHzGzmxiS0kS2//LiAwdaZtoSesBL3S4Le8qmhsGDAot8S+TpGvZ0hQf2Ze5V7tHkz uCPxYAhFo67waHSYEtFd00eYY7uPV32SOWdRo= |
| In-reply-to: | <FA856B4B684D2B4B93B22F7F92CA28F50709F072F6@TSM-EMAIL> |
| References: | <C66FD15D.5791F%markus_winter@online.de> <FA856B4B684D2B4B93B22F7F92CA28F50709F072F6@TSM-EMAIL> |
| Reply-to: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
| Sender: | realbasic-nug-bounces@lists.realsoftware.com |
>From LR (2009r2.1):
-----Quote: Start-----
For...Next Statement
Syntax
For counter [AS datatype] = start To | DownTo end [Step value]
counter: A local variable that will be incremented each time the loop
executes. It can be an Integer, Single, or Double.
Then in the "Notes" it says:
Counter must be a local variable and must be an Integer.
-----Quote: End-----
So, can Counter be a Double (and Single) or not? ;-)
Anyway, I once was bitten when using a double for a counter because I
was doing a comparison inside the loop that didn't work as I expected.
It was working for many values but for others it was not working.
An example:
for i As Double = 0 to 10 step 0.01
if i = 0.02 Then
MsgBox "i is 0.02"
elseif i = 0.12 Then
MsgBox "i is 0.12"
end if
next
The MsgBox never displays for "0.12" but it displays for "0.02".
Off course that when I found why this was not working, it was a "doh!"
moment. But it took awhile to figure because this happened with an
older RB version that doesn't show in the debugger the whole double
value and it was truncating it exactly with the same 2 decimal places.
Carlos
On Tue, Jun 30, 2009 at 1:32 PM, Kevin Gale wrote:
> You have defined i as an integer rather than a single or double.
> ________________________________________
>> From: Markus Winter
>> dim i as integer
>>
>> for i = 1 to 10 step 0.1
>> EditField1.AppendText Str(i) + EndOfLine
>> next
>>
>> It works fine with steps 1, -1, 2 etc but as soon as the step is not an
>> integer i fails to increment.
_______________________________________________
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> |
|---|---|---|
| ||
| Previous by Date: | Re: Is 'Find a Consultant' successfull?, Norman Palardy |
|---|---|
| Next by Date: | Re: Floating Window in WinXP, Steve Hutson |
| Previous by Thread: | Re: Why is this not incrementing?, Markus Winter |
| Next by Thread: | How to get the handle to a QTVideoTrack?, Thomas Tempelmann |
| Indexes: | [Date] [Thread] [Top] [All Lists] |