About Question enthuware.ocajp.i.v8.2.1472 :
Moderator: admin
-
- Posts: 1
- Joined: Mon Oct 29, 2018 4:08 pm
- Contact:
About Question enthuware.ocajp.i.v8.2.1472 :
Why does it fail to compile?
-
- Posts: 85
- Joined: Mon Dec 24, 2018 6:24 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1472 :
So e's scope is between the parentheses "(e, e->e.age<10000)" ?lambda expression does not create a new scope for variables.Therefore, you cannot reuse the local variable names that have already been used in the enclosing method
-
- Site Admin
- Posts: 10383
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1472 :
Yes, you can try it out. Use the the variable specified in the lambda expression after the expression and see what happens.
-
- Posts: 167
- Joined: Sun Apr 21, 2024 10:43 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1472 :
this one is very funny cuz i answeared 'It will compile fine and print true when run.' but then i went back cuz i realized the question was too easy, like something is missing, the trickyness is missing, so ye i doublechecked and found lol
Who is online
Users browsing this forum: Bing [Bot] and 12 guests