return
Part of KeywordsCategory
Description
Return exits a function
Example
/* Return exits a function. * If it's not a void function return allows you to return a value. */ import std.stdio; void f1 () { writefln("Running f1..."); } void f2 () { bit itsAGoodIdea = true; writefln("Running f2..."); if(itsAGoodIdea) { f1(); return; } writefln("Don't go there."); } void main () { f2(); writefln("The end."); }
Output
Running f2... Running f1... The end.