Mayank Khurana
Mayank Khurana

Reputation: 426

How to initialise an abstract in Julia?

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

Just wanted to create an abstract but it says following even when I use help?> Is there any alternate to this?

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.

Upvotes: 2

Views: 68

Answers (1)

David Sainez
David Sainez

Reputation: 6956

The correct syntax is abstract type Shape end.

You can find the docs in the REPL help mode with the full keyword:

help?> abstract type

There is online documentation on the keyword and more general documentation on types.

Upvotes: 4

Related Questions