嗨,我是 Swift 语言的新手,谁能解释一下为什么这里的 PI 符号有错误。
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
}
}
}
最佳答案
在 Xcode 中:“Editor”菜单,“Show Invisibles”。这将向您显示源代码中的不可见字符。
关于swift - 在 Swift 源代码中发现不可打印的 ASCII 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39329041/