Private Sub Byval As String If False Then Else Dim As: "File Not Found: "
Private Sub Byval As String If False Then Else Dim As: "File Not Found: "
Module calcolaMedia
Sub Main()
Dim Totale As Integer = 0
Dim contatore As Integer = 0
Dim media As Integer
Console.Write("Digita -1 per uscire")
Totale = numero
Do While (numero <> -1)
Console.Write("Numero: ")
Numero = Console.ReadLine()
Totale += numero
contatore += 1
Loop
If (contatore <> 1) Then
Console.WriteLine("La media : " & Totale / (contatore - 1) )
Else
Console.WriteLine("Non hai inserito nessun valore")
End If
End Sub
End Module
Module modTestExit
Sub Main()
Dim output As String = ""
Dim contatore As Integer
For contatore = 1 To 10
If contatore = 5 Then
Exit For
End If
Next
Console.WriteLine("Uscito da for: contatore = " & contatore)
Do Until contatore > 10
If contatore = 8 Then
Exit Do
Contatore += 1
Loop
Console.WriteLine("Uscito da do: contatore = " & contatore)
End Sub
End Module
Dim i As Integer
'method 1
Do While (i < 10)
Text1.Text = Text1.Text & i & ","
i = i + 1
Loop
i = 0 ' reset i
'method 2
Do
Text2.Text = Text2.Text & i & ","
i = i + 1
Loop While (i < 10)
End Sub
' Let us take a closer look at our do while loop:
'---------------------------------------------------------------'
Do While (i < 10)
'
Text1.Text = i
'
i = i + 1
'
Loop
'---------------------------------------------------------------' Do While - do while loop
' i < 10
' i=i+1
- increment o
' Loop
- loop while i less than 10
'---------------------------------------------------------------'Description:
'Loop until argument is set.
'Warning! The do while loop can crash your program if "done wrong".
'----------------------------------------------------------------------------
Module Module1
Sub Main()
Dim num As Integer = 0
Do
Console.WriteLine("Introduce un nmero entre 0 y 10")
num = Console.ReadLine()
Loop While num >= 10 Or num < 0
" &
num)
Do
Console.WriteLine("Introduce un nmero entre 0 y 10")
num = Console.ReadLine()
Loop Until num <= 10 Or num > 0
Console.WriteLine("El numero introducido con Loop Until es
num)
Console.ReadLine()
End Sub
End Module
" &
Form1.BackColor = vbWhite
End If
Control = Text1.Text
DoEvents
Loop
MsgBox Loop completado
End Sub