Skip to content

Commit

Permalink
For mejorado (foreach en Visual Basic.NET[39]⛓️)
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Jul 15, 2021
1 parent 96556b0 commit e850681
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions VisualBasic/Program.vb
Expand Up @@ -6,11 +6,16 @@ Imports System
Module Program
'Este codigo escribe un texto en amarillo con fondo azul
Public Sub Main(args As String())
Dim arreglo = New Integer() {5, 8, 3, 7, 4, 1}
Console.WriteLine("El elemento en la posicion 4 es " & arreglo(3))
Console.WriteLine("El tamaño es " & arreglo.Length)
For i = 0 To arreglo.Length - 1
Console.WriteLine("El valor del elemento " & i + 1 & " es " & arreglo(i))
Dim perros = New String() {"Monte", "Chupacabras", "Mikey", "Solovino", "El chiquito"}
Console.WriteLine("CON FOR")
For i = 0 To perros.Length - 1
Console.WriteLine("El perro " & i & " es " & perros(i))
Next
Console.WriteLine("CON FOR EACH")
Dim j = 0
For Each perro In perros
Console.WriteLine("El perro " & j & " es " & perro)
j = j + 1
Next
Console.Read()
End Sub
Expand Down

0 comments on commit e850681

Please sign in to comment.