To get documentation for a command

I tried
?println
as mentioned here.
I am getting an error as “UndefVarError: ? not defined”

Where did you try this? Can you copy-paste your input and output? This is what I get in the Julia REPL:

help?> println
search: println printstyled print_with_color print print_shortest sprint isprint

  println([io::IO], xs...)

  Print (using print) xs followed by a newline. If io is not supplied, prints to stdout.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> println("Hello, world")
  Hello, world
  
  julia> io = IOBuffer();
  
  julia> println(io, "Hello, world")
  
  julia> String(take!(io))
  "Hello, world\n"
2 Likes

Hi, thanks for the reply. I had tried it on IJulia

?println

Result

UndefVarError: ? not defined

That should work in the Jupyter notebook. Can you provide a screenshot?

Hi thanks for the reply.

Selection_001

Can check here as well.

Ah, yeah, I can reproduce that. Removing the first line (the #To get docs comment) fixes the issue. To use the help lookup, the ? character needs to be the very first thing in the cell.

You can get the same problem at the REPL:

julia> # This is a comment
       ?println
ERROR: UndefVarError: ? not defined

(note that I had to press alt-enter after the comment line to get a new line without executing anything)

4 Likes