-
Notifications
You must be signed in to change notification settings - Fork 381
Syntax isn't introduced #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am facing the same problem here.....cond: (Int, Int) => Boolean = (...). seems to be the function to check if the first parameter is less than the second and if yes return true, else false....but how the hell do i reference the parameters in the function...all it needs is (x <=y) ...terrible way to learn Scala from here |
You need to make a statement similar to a map: (x,y) => (x<y) You assign x,y as your two parameters and map them to the comparison you want to run later. Hope this helps. |
I think (Int,Int) => Boolean means a type You can understand it like a type(Int,Double,Long...) the right answer is: val cond:(Int,Int)=>Boolean = (x:Int,y:Int)=>x<y |
I had the same problem, this syntax is not previously introduced in the tutorial. Really not a good way to teach Scala. Thanks a lot to @albertocamposblanco, his solution was the key to complete the exercise: (x,y) => (x<y) |
As a scala newbie, I found this confusing as well. val cond: (Int, Int) => Boolean = < Is there a way of referring to the lessThan operator function in the built-ins? |
Yeah, I found this incredibly confusing as well, maybe an example of a similar condition being used earlier would help? |
There's no point where the following syntax is introduced:
exercises-scalatutorial/src/main/scala/scalatutorial/sections/StandardLibrary.scala
Line 120 in 23b132f
Even trying to scour the internet, it's difficult to find the solution that's expected.
The text was updated successfully, but these errors were encountered: