Check whether a range is empty

Steven Schveighoffer schveiguy at gmail.com
Fri Jul 13 19:05:20 UTC 2018


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


More information about the Digitalmars-d-learn mailing list