Comparison of programming languages (basic instructions): Difference between revisions

Content deleted Content added
Line 64:
! else if
! [[while loop|while]]
! [[do while loop|do while]]
! [[for loop|for i = 1 to N]]
! select case
Line 71 ⟶ 72:
| if (''condition'') { ''instructions'' } else if (''condition'') { ''instructions'' }
| while (''condition'') { ''instructions'' }
| do { ''instructions'' } while (''condition'')
| for (i = 0; i<N; i++) { ''instructions'' }
| switch (''variable'') { case ''case1'': ''instructions'' break; ... }
|-
| C++ (STL)
| as above
| as above
| as above
Line 82 ⟶ 85:
|-
| Java
| as above
| as above
| as above
Line 92 ⟶ 96:
| if ''condition'' then begin \n ''instructions'' \n end\n else begin \n ''instructions'' \n end;
| repeat \n ''instructions'' \n until ''condition'';
|
| for i := 1 to N do \n begin \n ''instructions'' \n end;
| case ''variable'' of \n ''meaning'': ''instructions''; \n default: ''instructions'' \n end;
Line 99 ⟶ 104:
| If ''condition'' Then \n ''instructions'' \n ElseIf ''condition'' Then \n ''instructions'' \n Else ''instructions'' \n End If
| Do While ''condition'' \n ''instructions'' \n Loop
| Do \n ''instructions'' \n Loop While ''condition''
| For i = 1 To N Step 1 \n ''instructions'' \n Next
|
Line 105 ⟶ 111:
| if ''condition'' : \n \t ''instructions'' \n else: \n \t''instructions'' \n
|
|
|
| for i in range(1, N): \n \t ''instructions'' \n
Line 113 ⟶ 120:
| if (''condition'') { ''instructions'' } else if (''condition'') { ''instructions'' }
| while (''condition'') { ''instructions'' }
|
| for (i = 0; i<N; i++) { ''instructions'' }
| switch (''variable'') { case ''case1'': ''instructions'' } { case ''case2'': ''instructions'' } ...