// example boolean expressions x > 2 0 <= y && y <= 10 ! (0 <= y && y <= 10 ) button.isVisible()A boolean expression evaluates to true or false. You can store it in a boolean variable e.g.
// storing a boolean expression in a variable boolean whether = x > 2;
// displaying a boolean variable on the console out.println( whether );You can use a boolean variable in an if later rather than
// referencing a boolean variable in an if if ( whether ) makeDate(); if ( ! whether && done() ) finish();
// ILLEGAL IN JAVA!! int is not the same as boolean int seen = button.isVisible(); if ( seen ) doSomething();
// boolean must be used in Java where in C you could use an int. boolean visible = button.isVisible(); if ( visible ) doSomething(); // or using an int with int-style syntax. int seen = button.isVisible() ? 0 : 1; if ( seen != 0 ) doSomething();
This page is posted |
http://mindprod.com/jgloss/boolean.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\boolean.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[18.117.145.41] |
| |
Feedback |
You are visitor number | |