使用自定义运算符时标识符无效

问题描述 投票:0回答:1

我需要创建一个在 x ^ 0 上返回 0 的自定义函数,所以我做了以下操作:

function custom_pow(base, exponent)
    if exponent == 0
        return 0
    else
        return base^exponent
    end
end


⟑(base, exponent) = custom_pow(base, exponent)

它在 REPL 上按预期工作: REPL Output

但是,如果尝试使用它调试代码,我会得到以下结果: Terminal Error

另外,如果我关闭并再次打开文件,自定义运算符 ⟑ (\wedgedot) 会更改为 ?

无论如何要让它发挥作用吗?我也在使用 VS Code

julia
1个回答
0
投票

正如 @k314159 评论的那样,使用 UTF-8 重新打开解决了这个问题,因为我使用的是 windows-1252

© www.soinside.com 2019 - 2024. All rights reserved.