-
Notifications
You must be signed in to change notification settings - Fork 1
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
solution2.5.2.2.scala provided #65
Conversation
Signed-off-by: Andreas Roehler <[email protected]>
*/ | ||
|
||
def collatzSequence(n: Int, xs: List[Int] = List(0)): List[Int] = | ||
if xs.head == 1 then xs.init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use syntax that is compatible with both Scala 2 and Scala 3. This code uses if then else
, which works only with Scala 3.
*/ | ||
|
||
def collatzSequence(n: Int, xs: List[Int] = List(0)): List[Int] = | ||
if xs.head == 1 then xs.init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if xs.head == 1 then xs.init | |
if (xs.head == 1) xs.init |
|
||
def collatzSequence(n: Int, xs: List[Int] = List(0)): List[Int] = | ||
if xs.head == 1 then xs.init | ||
else if n % 2 == 0 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if n % 2 == 0 then | |
else if (n % 2 == 0) |
Signed-off-by: Andreas Roehler <[email protected]>
No description provided.