On Friday, 13 July 2018 at 19:05:20 UTC, Steven Schveighoffer
wrote:
On 7/13/18 2:37 PM, vino.B wrote:
Hi All,
How do i check whether a range is empty. eg.
(!PFResutl.toRange).empty. I tired the below, but it is no
printing Empty if the range is empty it just prints blank line.
if (!(!PFResutl.toRange).empty) { writeln("Empty"); }
Without knowing what PFResutl is, let me simplify a bit:
if( ! (expr).empty) { writeln("Empty"); }
That exclamation point means "not". So you are first checking
if the range is NOT empty, and if so, printing "Empty". Is that
what you meant?
-Steve
Hi Steve,
Sorry there was a typo mistake, so the PFResult contain the
results of "taskPool.workerLocalStorage" which i print using
writeln(PFResult.toRange) so the requirement is that if the rage
is empty it has to print "Empty" else it should print the result.
Eg:
if (!(PFresult.toRange).empty) {
foreach(i; chain(PFresult.toRange)) { writeln(i[]); }
} else { writeln("Empty"); }
From,
Vino.B