Ask Question
3 May, 06:52

Must i but End if in this visual basic. 6 program

Sub main ()

Dim i as integer, p as integer

P = 1

For i = 1 to 100

if (1 mod 4 = 0) then

p = p*i

Next i

MsgBox " الناتج هو " & p

End sub

+4
Answers (1)
  1. 3 May, 07:54
    0
    You use end if only if the entire statement does not fit on one line.

    So this format does not require end if:

    If condition Then [ statements ]

    And this one does:

    If condition [ Then ]

    [ statements ]

    End If

    I left out the else syntax for simplicity.

    So the example program you gave will require an end if before the next i.

    The expression in the if statement should be (i mod 4) rather than (1 mod 4). Typo?
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Must i but End if in this visual basic. 6 program Sub main () Dim i as integer, p as integer P = 1 For i = 1 to 100 if (1 mod 4 = 0) then p ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers