void main() {
int a = 1;
double b = 1.1;
int c = (a+b).toInt();
double d = a+b;
var e = a+b;
String f = "test";
String g = "game";
print("${c} ${d} ${e} ${f+g}");
// ++
print("[++]");
print("${++a} ${a++}");
print("${a}");
// --
print("[--]");
print("${--a} ${a--}");
print("${a}");
a = 1;
a += 10;
print("a+= ${a}");
a = 1;
a -= 10;
print("a-= ${a}");
a = 2;
a *= 3;
print("a*= ${a}");
a = 6;
a ~/= 3;
print("a~/= ${a}");
a = 5;
a %= 3;
print("5%= ${a}");
}
}
int a = 100;
int b = 200;
void main() {
print("[A] ${a} ${b}");
int a = 1;
print("[B] ${a} ${b}");
{
int b = 2;
print("[C] ${a} ${b}");
}
print("[D] ${a} ${b}");
{
a = 1000;
b = 2000;
}
print("[E] ${a} ${b}");
}
void main() {
int a = 0;
switch(a) {
case 0:
print("a=0");
break;
case 1:
print("a=1");
break;
default:
print("other");
}
String b = "test";
switch(b) {
case "tests":
print("b=test");
break;
case "test":
print("b=test");
break;
default:
print("other");
}
int c = 0;
switch(c) {
case 0:
case 1:
print("c=0 or c=1");
break;
default:
print("other");
}
}
class A {
int a = 0;
int b = 0;
printStatus() {
print("${a} ${b}");
}
}
void main() {
A a = new A();
a.printStatus();
a.a = 100;
a.b = 200;
a.printStatus();
A b = a;
b.printStatus();
a.a = 3;
a.printStatus();
b.printStatus();
}