compiler-design-eth/javali_tests/HW4_nop90/Booleans/OkNot.javali
Carlos Galindo 72cc3206c4
Homework 4
2020-01-15 22:34:57 +01:00

36 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;
}
}
}