Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Ejemplos de bucles anidados
- Public Sub _new()
- End
- Public Sub Form_Open()
- 'bucle_repeat
- 'bucle_while
- bucle_for 'Este es el que se ejecuta
- 'bucle_for_each
- End
- Public Sub bucle_for()
- Dim a As Integer
- Dim b As Integer
- For a = 1 To 10 'Repetir de una a diez veces
- For b = 1 To 10 'Repetir de una a diez veces
- Print a & " * " & b & " = " & (a * b)
- Next
- Print 'Para dejar un espacio en blanco
- Next
- End
- Public Sub bucle_dowhile()
- Dim a As Integer
- Dim b As Integer
- a = 1
- b = 1
- Do While a <= 10 'Hacer mientras a sea mayor o igual a 10
- Do While b <= 10 'Hacer mientras a sea mayor o igual a 10
- Print a & " * " & b & " = " & (a * b)
- b = b + 1
- Loop
- Print
- b = 1
- a = a + 1
- Loop
- End
- Public Sub bucle_repeat()
- Dim a As Integer
- Dim b As Integer
- a = 1
- b = 1
- Repeat 'Repetir
- Repeat 'Repetir
- Print a & " * " & b & " = " & (a * b)
- a = a + 1
- Until (a > 10) 'Hasta que a sea mayor a 10
- Print 'Para dejar un espacio en blanco
- a = 1
- b = b + 1
- Until (b > 10) 'Hasta que b sea mayor a 10
- End
- Public Sub bucle_for_each()
- Dim tabla As Integer[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- Dim a, b As Integer
- For Each a In tabla ' Por cada numero entero en la tabla
- For Each b In tabla
- Print a & " * " & b & " = " & (a * b)
- Next
- Print 'Para dejar un espacio en blanco
- Next
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement