February 28, 2014
> 	bool isConfigExist()
>
> 		{
> 			configpath = exePath() ~ "config.txt";
> 			if (exists(configpath))
> 				{
> 				return true;	
> 				}
> 				
> 			else
> 			return false;
>
> 		}
>
> Now function return only bool and I need to make it's universal
>  to get text also

Probably not very good idea from me, I understand that I was wrong thinking!
February 28, 2014
On Friday, 28 February 2014 at 18:18:15 UTC, Suliman wrote:
> Probably not very good idea from me, I understand that I was wrong thinking!

In case you really-really-really want it, such behavior can be achieved via std.typecons.Tuple :

import std.typecons;

auto foo()
{
    return tuple(true, "text");
}

void main()
{
    auto ret_val = foo();
    assert(ret_val[1] == "text");
}

February 28, 2014
On 02/28/2014 06:42 AM, Dicebot wrote:

> You want static variables, either in form of global variables
> (discouraged) or static class fields:

Luckily, there is no global namespace in D. So, when it makes sense module-level global variables are fine as well.

Ali

1 2
Next ›   Last »