Function speed(ByVal s As Integer) As Integer Dim i As Integer = New Random().Next(3) If i = 2 Then Label1.Text = "スピードが遅い" s = 10 Return s ElseIf i = 1 Then Label1.Text = "スピードが速い" s = 200 Return s Else Label1.Text = "ちょうどいい" s = 40 Return s End If End Function