|
|
old BASIC syntax QBASIC, GWBASIC |
VisualBasic, VBA | C, C++ | Java | Java-Script | PHP | BASH | MATLAB, OCTAVE | 8086 Assembler (nasm) |
|---|---|---|---|---|---|---|---|---|---|
| comments |
REM Comment |
Rem Comment ' Another comment |
// Comment |
// Comment |
// Comment |
// Comment |
# Comment |
% Comment |
; Comment |
| multi line comment |
/* multi line comment */ |
/* multi line comment */ |
/* multi line comment */ |
/* multi line comment */ |
%{ multi line
comment
%}
|
|
|||
| if condition |
IF I=1 THEN ... ELSE ... END |
If I=1 Then ... Else ... End |
if (i==1) {
...
} else {
...
}
|
if (i==1) {
...
} else {
...
}
|
if (i==1) {
...
} else {
...
}
|
if ($i == 1) {
...
} else {
...
}
|
if [ $i -eq 1 ]; then ... else ... fi |
if i==1 ... else ... end |
cmp eax,1 jne not_eq equal: ... jmp continue not_eq: ... continue: ... |
| for loop |
FOR I = 0 TO 100 STEP 2 ... NEXT I |
For I = 0 To 100 Step 2 ... Next I |
for (i=0; i<=100; i+=2)
{
...
}
|
for (i=0; i<=100; i+=2)
{
...
}
|
for (i=0; i<=100; i+=2)
{
...
}
|
for ($i=0; $i<=100; $i += 2)
{
...
}
|
for i in `seq 0 2 100`; do echo $i done |
for i=0:2:100 ... end |
mov ax, 0 lbl1: ... add ax, 2 cmp ax, 100 jl lbl1 |
| while loop |
DIM i AS INTEGER; i = 1 WHILE ( i <= 100 ) ... i = i + 1 WEND |
DIM i AS INTEGER = 1 While ( i <= 100 ) ... i = i + 1 End |
int i = 1;
while ( i <= 100 ) {
...
i++;
}
|
int i = 1;
while ( i <= 100 ) {
...
i++;
}
|
var i = 1;
while ( i <= 100 ) {
...
i++;
}
|
$i = 1;
while ( $i <= 100 ) {
...
$i = $i + 1;
}
|
i=1 while test $i -le 100 do ... i=`expr $i + 1` done |
i=1 while(i<=100) ... i=i+1 end |
mov ax, 1 lbl1: ... add ax, 1 cmp ax, 100 jl lbl1 |
| short hallo world program |
PRINT "Hallo World!" |
Private Sub Form_Load() MsgBox "Hallo World!" End Sub |
//C style
#include <stdio.h>
int main()
{
puts ("Hallo World!");
return 0;
}
//C++ style
#include <iostream>
using namespace std;
int main()
{
cout<<"Hallo World!"<<endl;
return 0;
}
|
public class Main {
public Main() {
}
public static void main(String [] args) {
System.out.println("Hello World!");
}
}
|
<html>
<head>
<script type="text/javascript"><!--
alert("Hello World!");
//--></script>
</head>
<body>
</body>
</html>
|
<html>
<head>
</head>
<body>
<?php
print("Hello World!");
?>
</body>
</html>
|
#!/bin/bash echo "Hallo World!" |
disp "Hallo World!" |
section .data hello: db 'Hello world!',10 helloLen: equ $-hello section .text global _start _start: mov eax,4 mov ebx,1 mov ecx,hello mov edx,helloLen int 80h mov eax,1 mov ebx,0 int 80h |
Siehe auch