| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

10gbVisualBasicTeacher

Page history last edited by Mike Leishman 16 years, 9 months ago

Visual Basic

John Thorpe and students

Dim number_bottles As Integer
For number_bottles = 10 To 1 Step -1
If number_bottles = 1 Then
    txtPrynt.Text = txtPrynt.Text + vbCrLf + Str(number_bottles) + " "
+ "green bottle sitting on the wall!"
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottle sitting on the wall!"
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "and if one green bottle should accidentally fall"
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be no green bottles sitting on the wall!"
Else
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottles sitting on the wall!"
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottles sitting on the wall!"
    txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "and if one green bottle should accidentally fall"
End If
        If number_bottles = 2 Then
            txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be " + Str(number_bottles - 1) + " green bottle sitting on the wall!"
            Else
            If number_bottles <> 1 Then
                txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be " + Str(number_bottles - 1) + " green bottles sitting on the wall!"
            End If
        End If
Next number_bottles


Comments (0)

You don't have permission to comment on this page.