Julia · Lesson 1 · On the house

Hello Julia

println, comments, julia hello.jl, REPL basics. Lesson 1 is free — on the house.

Lessons · Julia · Lesson 1 of 10 · On the house

Hello Julia

println, comments, julia hello.jl, REPL basics.

Illustration for Julia
Lesson 1 is on the house.

println writes a line to standard output and adds a newline. print writes without the trailing newline — demos almost always start with println.

Line comments start with #. There is no // comment form in Julia. Multi-line comments use #= ... =#.

Save a script as hello.jl and run it with julia hello.jl from the shell. The .jl extension is the usual Julia source suffix.

Start an interactive session with bare julia. At the julia> prompt you can type expressions, see results, and exit with exit() or Ctrl-D.

Misses: writing console.log or puts, using // comments, or running python hello.jl instead of julia hello.jl.

hello

println("hello")
# a line comment
Match this when you type.

Quiz

Which call writes a line with a trailing newline?

Quiz

How do you start a single-line comment in Julia?

Quiz

How do you run a script file named hello.jl?

Quiz

What prompt marks the Julia REPL?

Check

Match the still for: Hello Julia.

Open-book: the answers are on this page. Pass every quiz and check (5) to mark the lesson done. This visit: 0/5.