“错误”;额外代币“;学校";在表达结束后;在Julia中使用Immutable时

“错误”;额外代币“;学校";在表达结束后;在Julia中使用Immutable时,julia,Julia,有人能帮我更正下面的代码吗 immutable School subject::Symbol nclasses::Intn students::Int # average no. of students per class end 我正在犯错误 syntax: extra token "School" after end of expression immutable不再是关键字,请使用与之等效的struct。如果需要可变对象,请使用mutabl

有人能帮我更正下面的代码吗

immutable School
    subject::Symbol
    nclasses::Intn
    students::Int  # average no. of students per class
end
我正在犯错误

syntax: extra token "School" after end of expression

immutable
不再是关键字,请使用与之等效的
struct
。如果需要可变对象,请使用
mutable struct
。以下是一些例子:

struct School_immutable
    subject::Symbol
    nclasses::Int
    students::Int  # average no. of students per class
end

mutable struct School_mutable
    subject::Symbol
    nclasses::Int
    students::Int  # average no. of students per class
end
有关概念的详细信息和关键字参数的文档,请参见