Recursive function call

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 24 03:57:25 PDT 2014


string getFileName()
{
	//чтобы было проще обрабатываемый файл будем хранить рядом с 
бинариком
	string filename = chomp(readln());
	string path = getcwd();
	writeln((path ~ "\\" ~ filename));
	if (exists(path ~ "\\" ~ filename))
		return (path ~ "\\" ~ filename);
	else
	{
		writeln("File do not exists. Please try again");
		getFilename(); //I need something similar, to call function 
again.
	}
	
}


In case of error, how I can call function getFileName again?


More information about the Digitalmars-d-learn mailing list