7 kyu
Forcing an Option
Description:
I'm trying to use:
def f(x: Int): Int = x + 5
with an Option[Int]
:
f(Some(42))
But I keep getting the following compilation error:
error: type mismatch;
found : Some[Int]
required: Int
f(Some(42))
^
Can you find a way to make this compile?
Puzzles
Similar Kata:
Stats:
Created | Jun 2, 2019 |
Published | Jun 2, 2019 |
Warriors Trained | 207 |
Total Skips | 5 |
Total Code Submissions | 320 |
Total Times Completed | 76 |
Scala Completions | 76 |
Total Stars | 2 |
% of votes with a positive feedback rating | 75% of 24 |
Total "Very Satisfied" Votes | 14 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |