Ejercicio
While + Contador
Objetivo
Cree un programa en Visual Basic para mostrar los números del 1 al 10 en la pantalla, usando "while".
Código
' Import the System namespace to use Console class
Imports System
Public Class Program
' Main subroutine, entry point of the program
Public Shared Sub Main()
' Declare a counter variable starting from 1
Dim counter As Integer = 1
' Start a while loop that will run as long as the counter is less than or equal to 10
While counter <= 10
' Display the current value of counter
Console.WriteLine(counter)
' Increment the counter by 1 after each iteration
counter += 1
End While
End Sub
End Class