--- Emile Schwarz <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> REALbasic 2006r4 Commercial Pro
> Mac OS X 10.4.6
> 
> In a Boolean If .../... Else .../... End If, I have added some
> variable Dim and 
> a loop who use them in the If part (True).
> 
> Then, I used the same code (copy/paste) in the Else part
> (False). (*)
> 
> All was OK 'till I realize that I have Dim lines inside
> (instead of at the top 
> as I usually set) my code and I Cut / Paste it where I want to
> place it.
> 
> Once that was done, I realized my other mistake:
> 
> I had two times the same Dim line, the first in the If part,
> and the second in 
> the Else part.
> 
> 
> You may say, it is a feature; but that feature let me place the
> same declaration 
> at two times in the same piece of code (a Menu Handler).

It not only lets you do that, it requires you to do that.  If you
Dim a variable inside an If/Then block, the scope of that
variable is the If/Then block.  The Else block is a separate
block, so the variable will be undefined in that block unless you
Dim it *in* that block too.

This is a consequence of relaxing the earlier restriction that
said Dim statements had to be in the topmost level of the code
(that is, the leftmost indentation level, not inside any If/Then,
For/Next, While/Wend, etc.).


Mark Nutter

Quick and easy regex creation and debugging!
http://www.bucktailsoftware.com/products/regexplorer/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to