Linguaggi di programmazione a confronto

WORK IN PROGRESS
Caratteristica Java C C++ C# Python PHP
Paradigma
di programmazione
Object Oriented Procedurale Object Oriented
Procedurale
Object Oriented Object Oriented
Funzionale
Procedurale
Object Oriented
Procedurale
Tipizzazione
variabili
Statica, forte Statica, debole Statica, forte Statica, forte Dinamica, forte Dinamica, debole
Compilato
Interpretato
Misto
Misto Compilato Compilato Misto Interpretato Interpretato
Risultato compilazione
Interprete
bytecode
Java Virtual Machine (JVM)
Intermediate Language (IL)
Common Language Runtime (CLR)
Gestione
della memoria
Garbage Collector Manuale Manuale Garbage Collector Garbage Collector Gestita dall'interprete
Delimitatore istruzione ; ; ; ; ;
Commento
riga
// // // // # // oppure #
Commento
multiriga
/* */ /* */ /* */ /* */ /* */
Dichiarazione
variabili
byte x = 10;
short x = 10;
int x = 10;
long x = 10;
float y = 5.5;
double y = 5.5;
boolean b = true;
char c = 'A';
String s = "test";
short x = 10;
int x = 10;
long  x = 10;
float y = 5.5;
double y = 5.5;
_Bool b = 1;
char c = 'A';
char s[] = "test";
short x = 10;
int x = 10;
long  x = 10;
float y = 5.5;
double y = 5.5;
bool b = true;
char c = 'A';
std::string s = "test";
int x = 10;
double y = 5.5;
bool b = true;
char c = 'A';
string s = "test";
x = 10
y = 5.5
b = True
c = 'A'
s = "test"
$x = 10;
$y = 5.5;
$b = true;
$c = 'A';
$s = "test";
Input
import java.util.Scanner;
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
#include <stdio.h>
char input[100];
scanf("%s", input);
#include <iostream>
std::string input;
std::cin >> input;
using System;
string input = Console.ReadLine();
input_var = input("Inserisci un valore: ")
$input = readline("Inserisci un valore: ");
Output
System.out.println("Hello World");
#include <stdio.h>
printf("Hello World\n");
#include <iostream>
std::cout << "Hello World" << std::endl;
using System;
Console.WriteLine("Hello World");
print("Hello World")
echo "Hello World";
Selezione semplice
if (<condizione>) {
    ...
}
if (<condizione>) {
    ...
}
if (<condizione>) {
    ...
}
if (<condizione>) {
    ...
}
if <condizione>:
    ...
if (<condizione>) {
    ...
}
Selezione doppia
if (<condizione>) {
    ...
} else {
    ...
}
if (<condizione>) {
    ...
} else {
    ...
}
if (<condizione>) {
    ...
} else {
    ...
}
if (<condizione>) {
    ...
} else {
    ...
}
if <condizione>:
    ...
else:
    ...
if (<condizione>) {
    ...
} else {
    ...
}
Selezione multipla
if (<condizione1>) {
    ...
} else if (<condizione2>) {
    ...
} else {
    ...
}
if (<condizione1>) {
    ...
} else if (<condizione2>) {
    ...
} else {
    ...
}
if (<condizione1>) {
    ...
} else if (<condizione2>) {
    ...
} else {
    ...
}
if (<condizione1>) {
    ...
} else if (<condizione2>) {
    ...
} else {
    ...
}
if <condizione1>:
    ...
elif <condizione1>:
    ...
else:
    ...
if (<condizione1>) {
    ...
} else if (<condizione2>) {
    ...
} else {
    ...
}
Switch
switch (<variabile>) {
    case valore1: 
        ...
        break;
    case valore2: 
        ... 
        break;
    ...
    case valoreN: 
        ... 
        break;
    default: 
        ...
}
switch (<variabile>) {
    case valore1: 
        ...
        break;
    case valore2: 
        ... 
        break;
    ...
    case valoreN: 
        ... 
        break;
    default: 
        ...
}
switch (<variabile>) {
    case valore1: 
        ...
        break;
    case valore2: 
        ... 
        break;
    ...
    case valoreN: 
        ... 
        break;
    default: 
        ...
}
switch (<variabile>) {
    case valore1: 
        ...
        break;
    case valore2: 
        ... 
        break;
    ...
    case valoreN: 
        ... 
        break;
    default: 
        ...
}
match <variabile>:
    case valore1:
        ...
    case valore2:
        ...
    ...
    case valoreN:
            ...
    case _:
        ...
switch (<variabile>) {
    case valore1: 
        ...
        break;
    case valore2: 
        ... 
        break;
    ...
    case valoreN: 
        ... 
        break;
    default: 
        ...
}