Skip to content

Commit

Permalink
Add kwdef to structs
Browse files Browse the repository at this point in the history
  • Loading branch information
abhro committed Jun 17, 2024
1 parent 375370c commit 768b7a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Type holding information about an observing site. Its fields are:
* `altitude`: altitude of the site in meters
* `tz`: the number of hours of offset from UTC
"""
struct Observatory
Base.@kwdef struct Observatory
name::String
latitude::Float64
longitude::Float64
Expand All @@ -36,8 +36,8 @@ function show(io::IO, obs::Observatory)
println(io, "longitude: ", obs.longitude, "°E")
println(io, "altitude: ", obs.altitude, " m")
tzdec, tzint = modf(obs.tz)
print(io, "time zone: ", @sprintf("UTC%+d", tzint),
tzdec == 0 ? "" : @sprintf(":%d", abs(tzdec*60)))
tzstr = tzdec == 0 ? "" : @sprintf(":%d", abs(tzdec*60))
print(io, "time zone: ", @sprintf("UTC%+d", tzint), tzstr)
end

##### Planet
Expand Down Expand Up @@ -68,7 +68,7 @@ Position characteristics (epoch J2000):
* `per_long`: longitude of perihelion in degrees
* `mean_long`: mean longitude in degrees
"""
struct Planet
Base.@kwdef struct Planet
name::String
radius::Float64
eqradius::Float64
Expand Down

0 comments on commit 768b7a6

Please sign in to comment.