Introduction to Julia
James Fulton
Climate informatics researcher
println(1+1)
x = 0
y = "fin"
x = [1,2,3,4,5]
x .* 2
x[2:end]
if enjoyment == 5
println("Leave a rating?")
else
println("Goodbye :)")
end
function f(x)
return x^2 + 2*x + 1
end
Broadcasting
x = [1,2,3]
y = f.(x)
Multiple dispatch
function f(x::Int64)
return x^2 + 2*x + 1
end
function f(x::Bool)
return x
end
Using Packages
import Statistics
using DataFrames
DataFrames
df = DataFrames(CSV.Files("run.csv"))
Introduction to Julia