vb2Py

  VB Control Structures
Visual Basic flow control structures and their Python equivalents

QuickLinks

VB keywords

Subroutines and Functions

Classes

Error Handling


 
  Home
  News
  Downloads
  Documentation
  Screenshots
  Online Version
  Links
  Contribute

 

VB Code
Python Code

If Condition1 Then
    Statements
Else If Condition2
    Statements
Else
    Statements
End If

if Condition1:
    Statements
elif Condition2:
    Statements
else:
    Statements

Select Variable
Case Value1
    Statements
Case Value2
    Statements
Case Else
    Statements
End Select


if Variable == Value1:
    Statements
elif Variable == Value2:
    Statements
else:
    Statements
Do While Condition
    Statements
End Do
while Condition:
    Statements

While Condition
    Statements
Wend


while Condition:
    Statements
Do Until Condition
    Statements
Loop
while 1:
    Statements
    if not Condition:
        break
Do Until Condition
    Statements
Loop
while not Condition:
    Statements

Do
    Statements
Loop Until Condition
while 1:
    Statements
    if Condition:
        break

For i = x To y
    Statements
    If C1 Then Exit For
    If C2 Then Next
Next i


for i in range(x, y+1):
    Statements
    if C1: break
    if C2: continue
For Each Obj in Coll
    Statements
    If C1 Then Exit For
    If C2 Then Next
Next Obj
for Obj in Coll:
    Statements
    if C1: break
    if C2: continue

 

 

 

    SourceForge.net Logo