The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

fbgava (3) [Avatar] Offline
#1
Hi,

After trying the code listed in Quick check 4.4, I'm getting a different output from the provided answer.

My code:

scala> :paste
// Entering paste mode (ctrl-D to finish)

var a = b
val b = "hello"
a.length

// Exiting paste mode, now interpreting.

<console>:11: warning: Reference to uninitialized value b
       var a = b
               ^
java.lang.NullPointerException
  ... 37 elided


Is this happening because I'm using a more recent Scala version (2.12.3)?

Thanks.
Daniela Sfregola (12) [Avatar] Offline
#2
Hi @fbgava,
I just had a look and it seems like the answer to the quick check is wrong. Nothing to do with your Scala version smilie

I'll make sure to fix it as soon as possible!

Cheers,
Daniela