Hi, I am new to Swift language , can anyone explain why there is error with PI Symbol here.
import Foundation
class CalculatorBrain
{
private var accumulator = 0.0
func setOperand(operand : Double) {
accumulator = operand
}
func performOperations (symbol: String) {
switch symbol {
case "π" :
accumulator = M_PI
case "√" :
accumulator = sqrt(accumulator)
default : break
}
}
var result : Double {
get{
return accumulator
}
}
}
reference https://youtu.be/j50mPzDMWVQ?t=2303
In Xcode: "Editor" menu, "Show Invisibles". That will show you invisible characters in your source code.
This answer is for the people who are using windows keyboard with mac system.
While typing you might have unknowingly clicked the right click key in your keyboard, which will create the Unprintable ASCII character that is causing the Unprintable ASCII character found in source file error.
To check this go to find and click the right click key and you can find them in your class and delete those characters and the error will be gone.
Thanks
If you open it in a terminal with an editor such as Vim, you will see that it contains ASCII characters.
enter image description here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With