Multiple Variables

后端 未结 9 2010
不知归路
不知归路 2020-12-19 04:49

Is there a way to give a value to multiple variables (integers in this case), instead of all at once?

For instance, I have Dim aceVal, twoVal, threeVal, fourVa

9条回答
  •  失恋的感觉
    2020-12-19 05:46

    you can put it in List and use For Each method here is the code

    Dim aceVal, twoVal, threeVal, fourVal, fiveVal, sixVal, sevenVal, eightVal, nineVal, tenVal As Integer
    Dim var As New List(Of Integer) From {threeVal, fiveVal, sixVal} 'you can add more variable here
    For Each n As Integer In var
        n = -1
    Next
    

提交回复
热议问题