36 lines
559 B
Text
36 lines
559 B
Text
julia> function foo(x) x + 1 end
|
|
foo (generic function with 1 method)
|
|
|
|
julia> foo(42)
|
|
43
|
|
|
|
julia> foo(42) === 43.
|
|
false
|
|
|
|
|
|
Here we match all three lines of code:
|
|
|
|
julia> function foo(x::Float64)
|
|
42. - x
|
|
end
|
|
foo (generic function with 2 methods)
|
|
|
|
julia> for x in Any[1, 2, 3.4]
|
|
println("foo($x) = $(foo(x))")
|
|
end
|
|
foo(1) = 2
|
|
foo(2) = 3
|
|
foo(3.4) = 38.6
|
|
|
|
|
|
... unless it is not properly indented:
|
|
|
|
julia> function foo(x)
|
|
x + 1
|
|
end
|
|
|
|
|
|
Ordinary Julia code does not get highlighted:
|
|
|
|
Pkg.add("Combinatorics")
|
|
abstract type Foo end
|