Auto keyword and when to use it

Colin grogan.colin at gmail.com
Mon Aug 20 17:54:17 UTC 2018


On Monday, 20 August 2018 at 17:52:17 UTC, QueenSvetlana wrote:
> Great!
>
> So I can't declare class level variables with auto, correct? 
> only local method variables?

You can use auto if you're setting the class level variable to a 
default.

class X {
   auto i = 42; // i will be an int

}


More information about the Digitalmars-d-learn mailing list