advertisement

Article:
  VB.NET Data Types
Subject:   Preceding the Completing my question
Date:   2001-08-01 08:26:38
From:   dannyo152
Response to: Completing my question

[What a mess... I thought my first part got sent, apparently it was lost.]


In your example of:


Dim N As Long ' N is declared outside the block
' and has procedure scope.
For I = 1 To 10
N = N + Incr(I)
Next
W = Base ^ N ' N is visible outside the block but I is not.


demonstrating scope, since "option explicit" is the default, wouldn't the variable I have necessarily been declared prior to its use, and thus, have scope outside of the loop?


Is the following:


for (dim I as Integer = 1 ) to 10


allowed?


Thank you and my apoligies for the clumsiness of my posting techniques.


Dan

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • declaring variable in loop
    2008-04-23 03:50:29  hilson28 [Reply | View]

    you use

    For i as Integer = 1 To 10