This commit is contained in:
Benedikt Ehinger
2023-10-09 16:40:47 +02:00
parent 1a1ea6fde2
commit 958f1780cc
2 changed files with 163 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
a = zeros(10)
for k = 1:10
a[k] = k
end
a
#---
# composite type
# abstract type
struct SimulationResults
parameters
results::Union{Nothing,Int}
end
function SimulationResults(params)
results = rand(100)*params[1]
return SimulationResults(params,results)
end
function print(s::NamedTuple)
println("hey, please use SimulationResults next time ;)")
end
import Base: show
function Base.show(io::IO,s::SimulationResults)
println(io,"The following simulation was run:")
println(io,"Parameters: ",s.parameters)
println(io,"And we got results!")
println(io,"Results: ",s.results[1])
end
#---