37 lines
409 B
Text
37 lines
409 B
Text
|
// Test '!' operator
|
||
|
|
||
|
class Main {
|
||
|
void main() {
|
||
|
boolean a,b,c,d;
|
||
|
int x,y;
|
||
|
|
||
|
a = true;
|
||
|
c = !false;
|
||
|
b = !a;
|
||
|
x = 100;
|
||
|
y = 5;
|
||
|
|
||
|
if (a) {
|
||
|
write(1);}
|
||
|
writeln();
|
||
|
|
||
|
if (!b){
|
||
|
write(2);
|
||
|
}
|
||
|
writeln();
|
||
|
|
||
|
while(c){
|
||
|
write(3);
|
||
|
c = false;
|
||
|
}
|
||
|
writeln();
|
||
|
|
||
|
// !x < 2 * y --> !x type error
|
||
|
// !(x < 2 * y) --> correct syntax
|
||
|
while(!(x<2*y)){
|
||
|
write(y);
|
||
|
y = y*2;
|
||
|
}
|
||
|
}
|
||
|
}
|