首页 > 解决方案 > 如何在 Julia 中初始化摘要?

问题描述

Julia> abstract Shape
ERROR: syntax: extra token "Shape" after end of expression
Stacktrace:
 [1] top-level scope at REPL[64]:0

只是想创建一个摘要,但即使我使用帮助它也会说跟随?> 有什么替代方法吗?

help?> abstract
search: AbstractSet abstract type AbstractChar AbstractDict AbstractFloat

Couldn't find abstract
Perhaps you meant struct or AbstractSet
  No documentation found.

  Binding abstract does not exist.

标签: julia

解决方案


正确的语法是abstract type Shape end.

您可以使用 full 关键字在 REPL 帮助模式中找到文档:

help?> abstract type

关于关键字的在线文档和关于类型的更一般的文档


推荐阅读