Explain function syntax

Ali Çehreli acehreli at yahoo.com
Thu Sep 18 18:10:13 UTC 2025


As stated by multiple people, most nested functions will be 'delegates'. 
However, a nested function is a 'function' if it does not touch local scope:

void main() {
     int twice(int i) {
         return i * 2;
     }

     // Not a delegate:
     static assert(is (typeof(twice) == function));
}

Ali



More information about the Digitalmars-d-learn mailing list