# How to work with julia's structs

**URL:** https://discourse.julialang.org/t/how-to-work-with-julias-structs/19783
**Category:** New to Julia
**Tags:** data\_structures
**Created:** [January 18, 2019, 1:46pm UTC](https://discourse.julialang.org/t/how-to-work-with-julias-structs/19783 "2019-01-18T13:46:16Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [January 18, 2019, 1:56pm UTC](https://discourse.julialang.org/t/how-to-work-with-julias-structs/19783/2 "2019-01-18T13:56:05Z")

</div>

Welcome,

please take a look at [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

Regarding your problem, [Constructors · The Julia Language](https://docs.julialang.org/en/v1/manual/constructors/index.html) is likely good reading.

You could do for example:

```julia
julia> struct Point{T}
           r::T
           theta::T
           phi::T
           x::T
       end

julia> Point(r, theta, phi) = Point(r, theta, phi, r * sin(theta) * cos(phi))
Point

julia> Point(2.0, 0.3, 0.5)
Point{Float64}(2.0, 0.3, 0.5, 0.5186867601044616)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-work-with-julias-structs/19783)._
