Page 1 of 1

About Question enthuware.ocajp.i.v8. 2 . 1466 :

Posted: Tue Oct 20, 2015 11:37 pm
by Mushfiq Mammadov
Semicolon is missing
Image

Re: About Question enthuware.ocajp.i.v8.2.1466 :

Posted: Wed Oct 21, 2015 12:17 am
by admin
Well, the explanation is highlighting only the lack of curly brackets and the return keyword. The next sentence gives you the reason why that is important. I don't see anything wrong with the explanation or the given code.

Re: About Question enthuware.ocajp.i.v8. 2 . 1466 :

Posted: Wed Oct 21, 2015 2:28 am
by Mushfiq Mammadov
There is no problem in explanation, everything is clear. But according to underlined sentence the code will not compile if we add curly brackets and the return keyword because of semicolon is missing:

Code: Select all

printImportantData(al, (Data d)->{ return d.value>1 } );  // DOES NOT COMPILE
It would be good that it is written:
"Notice the lack of curly brackets, return keyword and the semicolon".

Re: About Question enthuware.ocajp.i.v8. 2 . 1466 :

Posted: Wed Oct 21, 2015 3:34 am
by admin
The sentence is asking you to notice only the two (out of three) changes because it is talking about those two changes in the next sentence.
It does not claim that if you add the two things back it will compile.
Yes, semicolon is missing as well but that is part of the syntax. The statement is trying to explain why the return and curly braces are removed.

Re: About Question enthuware.ocajp.i.v8. 2 . 1466 :

Posted: Wed Oct 21, 2015 12:57 pm
by Mushfiq Mammadov
It is written that "This can be shortened to:", so in short form curly brackets, return keyword and semicolon are removed. Two of them are noted but semicolon not. I had some mistakes regarding it when I test some questions and therefore I thought that it would be helpful for readers to notice semicolon too. But you are free if you want you may change it or not, I haven't any request regarding it. Just I send feedback for only reminding, because I guess maybe it would be helpful :)

Re: About Question enthuware.ocajp.i.v8. 2 . 1466 :

Posted: Wed Oct 21, 2015 9:34 pm
by admin
Ok, updated.
thank you for your feedback!