How to Use Boolean Script
- 1). Construct a boolean object in your Java script by entering the following code: "boolean isTooLarge = true;." Boolean objects can only be true or false.
- 2). Create a test result to assign to your variable by typing the following code:
String someText = "Here is a bit of text";
if(someText.length()<60) isTooLarge = false;
System.out.printlng("Too Large? " + isTooLarge);
Click "Run" to run your program. This will test to see if the string length is too long and the result can be assigned to your boolean object. - 3). Type the following script to assign the result from step 4 to your boolean object:
public boolean isBelowMinimum(String testText) {
boolean tooLarge = false;
if(testText.length()<60) tooLarge = true;
return tooLarge;
}
Source...