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:

CreatedJun 2, 2019
PublishedJun 2, 2019
Warriors Trained207
Total Skips5
Total Code Submissions320
Total Times Completed76
Scala Completions76
Total Stars2
% of votes with a positive feedback rating75% of 24
Total "Very Satisfied" Votes14
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes2
Total Rank Assessments6
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • xavierguihot Avatar
  • SQSCWQ Avatar
  • KayleighWasTaken Avatar
Ad