julia programming tutorial code example
Example 1: julia class
# Julia does not have classes.
# The closest one can get to classes with methods in Julia is the module:
module DogClass
export Dog, bark
struct Dog
name::String
end
function bark(d::Dog)
println(d.name, " says woof!")
end
end #MODULE
using .DogClass # note the . here, means look locally for module, not library
mydog = Dog("Fido")
bark(mydog)
Example 2: julia programming plotting
x = 1:10; y = rand(10, 2) # 2 columns means two lines
plot(x, y)