3 ms·
the val and const cases should hardly be different if the compiler has constant folding, except maybe for the typing.
by bruce343434 5y ago
the val and const cases should hardly be different if the compiler has constant folding, except maybe for the typing.
- JulianMorrison 5y agoFrom the language reference > Constant expressions may contain only constant operands and are evaluated at compile time. and a "const" can only be defined with a constant expression. So the difference would be that a "val" can be assigned a value that is evaluated at runtime.