Re: Return data from different types of conditional operation

2015-04-23 Thread John Colvin via Digitalmars-d-learn
On Thursday, 23 April 2015 at 09:48:21 UTC, Dennis Ritchie wrote: 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

Re: Return data from different types of conditional operation

2015-04-23 Thread rumbu via Digitalmars-d-learn
On Thursday, 23 April 2015 at 10:06:45 UTC, John Colvin wrote: On Thursday, 23 April 2015 at 09:48:21 UTC, Dennis Ritchie wrote: Hi, Why the program can not return different types of data from the conditional operator? - import std.stdio; auto foo() { if (true) {

Return data from different types of conditional operation

2015-04-23 Thread Dennis Ritchie via Digitalmars-d-learn
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); }

Re: Return data from different types of conditional operation

2015-04-23 Thread wobbles via Digitalmars-d-learn
On Thursday, 23 April 2015 at 09:48:21 UTC, Dennis Ritchie wrote: 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

Re: Return data from different types of conditional operation

2015-04-23 Thread Dennis Ritchie via Digitalmars-d-learn
Thank you all. I did not know before, that this behavior is characteristic of dynamically typed programming languages.

Re: Return data from different types of conditional operation

2015-04-23 Thread biozic via Digitalmars-d-learn
On Thursday, 23 April 2015 at 10:26:09 UTC, rumbu wrote: On Thursday, 23 April 2015 at 10:06:45 UTC, John Colvin wrote: On Thursday, 23 April 2015 at 09:48:21 UTC, Dennis Ritchie wrote: Hi, Why the program can not return different types of data from the conditional operator? - import