Navigation:  Language Reference > Types >


Previous pageReturn to chapter overviewNext page

Either true (1) or false (0). Variables of this type should not be used to store any other values. Like C++, 20-sim evaluates non-zero values as true; only the value of zero is evaluated as false. Normally, the value of one is used to indicate true.


boolean a;

boolean b = true;

boolean c = false;

boolean D[2,2] = [true,true;false;false];

a = b and c;



When used in standard functions, booleans are treated as reals with value 0 or 1. An equation like:


boolean a = true;

real c;

c = sin(a);


would yield c equal to 0.8415. Try to avoid these constructions, since they lead to confusions.