2012-12-27 44 views
0

新東西在這裏,我搞亂了VB 2012,當我發現我的程序只循環一次。 幫助,將不勝感激。Visual Basic控制檯應用程序只循環一次

Module Module1 
    Dim i As Integer = 0 

    Sub Main() 
     While i < 3 
      i = i + 1 
      Console.WriteLine(i) 
      Console.ReadLine() 
     End While 
     End 
    End Sub 
End Module 

編輯: 呀,這裏的人是正確的,與該代碼是不可能的,所以我搞砸了一下週圍越來越與解決方案

Module Module1 
    Dim i As Integer = 0 
    Sub Main() 
     While i < 3 
      i = i + 1 
      Console.WriteLine(i) 
      System.Threading.Thread.Sleep(1000) 
     End While 
    End Sub 
End Module 
+1

不可能與上面的代碼。第一次循環後你是否按回車? :-) – Steve

回答

0

你爲什麼要投入額外上來End?你確定這不是罪魁禍首嗎?

While i < 3 
    i = i + 1 
    Console.WriteLine(i) 
    Console.ReadLine() 
End While 
End <-- not required. 
+0

...你如何發表新文章?我無法開始新的路線。 – Croccy

+0

@ user1932140評論不是放置多行代碼的好地方。如果您需要這樣做,請將其添加到您的問題中。 –

相關問題