assert

Tim Matthews tim.matthews7 at gmail.com
Wed Jul 8 02:51:39 PDT 2009


Ellery Newcomer wrote:
> I'm tired and witless just now, but I can't think of any reason why
> assert should be an expression and not a statement.
> 
> Any clues?

assert only evaluates to void but maybe someone writes something like:

module test;

import std.stdio;

void main()
{
     bool readyForMath = true;
     int i = 2;
     int result = (assert(readyForMath),i*=i,i++);
     writeln(i);
}


More information about the Digitalmars-d-learn mailing list