Just so I'm clear about this. The section talks about variable x not being effectively final because its value changes later on in the code. So when an attempt is made to "use" a variable within the body of a lambda expression, lambda checks the scope of what - its method, its class, all the classes in the program, to see if the variable is final or effectively final?
Please feel free to over elaborate Thanks
[HD Pg 372, Sec. 12.5.4 - scope-of-variables-in-a-lambda-expression]
Moderator: admin
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 372, Sec. 12.5.4 - scope-of-variables-in-a-lambda-expression]
Scope of a local variable is within that method. It cannot be accessed from anywhere else. So only the method code needs to be checked.
If you like our products and services, please help us by posting your review here.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 372, Sec. 12.5.4 - scope-of-variables-in-a-lambda-expression]
Nice to know that lambdas don't change the local variable scope rules.
Who is online
Users browsing this forum: Bing [Bot] and 104 guests