Tuesday, November 23, 2010

Do While and Do Until Loops

'A loop goes around and around until the condition is met

'Example of a Do While Loop- NOTE: intNum must be dimensioned

intNum =1 'If you don't set intNum to 1 then intNum = 0
Do While IntNum <=3
MessageBox.Show (intNum.ToString)
intNum= intNum +1
Loop
-------------------------------------------------------------------
'Example of a Do Until Loop:

intNum = 1
Do Until IntNum > 3
MessageBox.Show (intNum.ToString)
intNum= intNum +1
Loop

In the comment section, tell the output of each program for 5 points

10 comments:

  1. intNum adds 1 every time untill its greater than three and jumps out of loop

    ReplyDelete
  2. the first one will keep going until three and the second one will keep going until it is greater then three.

    ReplyDelete
  3. For the first one, it will keep displaying the intnum in a message box untill it hits 3.
    For the second one, it will do the same thing untill it is greater then 3.

    ReplyDelete
  4. the first will add until it is equal to 3 the second will go until it is greater than 3

    ReplyDelete
  5. The first time around will continue to go until it reaches 3.
    The second time will go on until it is greater than 3.

    ReplyDelete
  6. The first one will keep going until three and the second one will keep going until it is greater than three.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. 1st one will go until it equals 3 and the 2nd will go until its higher than 3.

    ReplyDelete
  9. The first time around will continue to go until it reaches 3.
    The second time will go on until it is greater than 3.

    ReplyDelete