Values in Julia

Julia has various value types including strings, integers, floats, booleans, etc. Here are a few basic examples.

# Strings, which can be concatenated with *
println("julia" * "lang")

# Integers and floats
println("1+1 = ", 1 + 1)
println("7.0/3.0 = ", 7.0 / 3.0)

# Booleans, with boolean operators as you'd expect
println(true && false)
println(true || false)
println(!true)

To run the program, save it as values.jl and use the julia command:

$ julia values.jl
julialang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

In Julia, strings are concatenated using the * operator instead of +. The println function is used for output, similar to fmt.Println in the original example. Julia’s syntax for arithmetic operations and boolean logic is very similar to many other programming languages.

Julia is an interactive language, so you can also run these commands directly in the REPL (Read-Eval-Print Loop) by starting Julia with the julia command and then typing the commands at the prompt.