My new favorite D feature

alex4u2nv blight at gmail.com
Wed Dec 20 06:12:18 PST 2006


Im new to this language and just getting aquainted, but what happens in the
scenario of saving and evaluating the return value of a function within the if
statement to be used elsewhere.

bool search() { //find something; if (..) return index; else return 0;//not found }

if ( retval = search() )
   {
     writefln("found:");
     writefln(retval);
   } else {
     writefln( "not found" );
   }


// or something similar?



More information about the Digitalmars-d mailing list