User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:08_object:04_generator:04_guard_operator

This is an old revision of the document!


Guard Operator

The guard operator a :: b defines a generator expression which yields a if b is true and no value at all if b is false.

This is especially useful if a is a generator expression itself, then the guard b filters the values yielded by a. The following generator expression yields all lowercase letters from a String s:

public void run ()
{
	String s = "tEa,asAZf";
	char c;
	((c = s.charAt(0 : s.length() - 1)) :: Character.isLowerCase(c), print(c)); // print taasf
}
01_user_documentation/07_rgg_xl/02_xl/08_object/04_generator/04_guard_operator.1755678740.txt.gz · Last modified: 2025/08/20 10:32 by gaetan