Will Beethoven Will Beethoven - 4 months ago 8
Swift Question

Get bogus value when using break point before a variable in Swift

Code

I got an bogus value of finalScore, what happened?

I want to know why finalScore is 4339953456 rather than a correct number 520.

Answer

Your breakpoint is on the finalScore = line, it means that the program is stopped before this value has been computed.

It should show no value instead of a bogus value, probably, but this is not something that you have to worry about: set your breakpoint one line later and your finalScore will have a proper value.