Return data from different types of conditional operation

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 23 02:48:18 PDT 2015


Hi,
Why the program can not return different types of data from the 
conditional operator?

-----
import std.stdio;

auto foo() {

	if (true) {
		return 0;
	} else
		return "true";
}

void main() {

	writeln(foo);
}


More information about the Digitalmars-d-learn mailing list