Re: Lambdas Scope

2022-04-11 Thread Timon Gehr via Digitalmars-d-learn
On 11.04.22 11:11, Salih Dincer wrote: How is this possible? Why is it compiled? Don't the same names in the same scope conflict? ```d int function(int) square; void main() {   square = (int a) => a * a;   int square = 5.square;   assert(square == 25); } ``` Thanks, SDB@79 - Local variabl

Re: Lambdas Scope

2022-04-11 Thread user1234 via Digitalmars-d-learn
On Monday, 11 April 2022 at 09:11:06 UTC, Salih Dincer wrote: How is this possible? Why is it compiled? Don't the same names in the same scope conflict? ```d int function(int) square; void main() { square = (int a) => a * a; int square = 5.square; assert(square == 25); } ``` Thanks, SDB@

Lambdas Scope

2022-04-11 Thread Salih Dincer via Digitalmars-d-learn
How is this possible? Why is it compiled? Don't the same names in the same scope conflict? ```d int function(int) square; void main() { square = (int a) => a * a; int square = 5.square; assert(square == 25); } ``` Thanks, SDB@79