Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  VB.NET Data Types
Subject:   Completing my question
Date:   2001-08-01 08:21:08
From:   dannyo152
[I apologize: I keep hitting the tab key in order to indent my comments.]


for dim I as Integer = 1 to 10
...


is acceptable?

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Preceding the Completing my question
    2001-08-01 08:26:38  dannyo152 [View]

    [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
    • declaring variable in loop
      2008-04-23 03:50:29  hilson28 [View]

      you use

      For i as Integer = 1 To 10