# Need help for Julia -struct - Global variable

**URL:** <https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540>\
**Category:** General Usage\
**Created:** [September 21, 2022, 3:13am UTC](https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540 "2022-09-21T03:13:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![B\_Linkoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/b_linkoon/32/42827_2.png) [@B\_Linkoon](https://discourse.julialang.org/u/B_Linkoon)\
**Post date:** [September 21, 2022, 3:13am UTC](https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540/1 "2022-09-21T03:13:26Z")

</div>

Hi, I am new to Julia. Could you please help me to understand the following line of codes. and how to define and access values @ Mesh struct. Thank you in advance.

using StaticArrays

struct Mesh{I \<: Integer, F \<: Real}  
vertices::Vector{SVector{2, F}}  
segments::Vector{SVector{2, I}}  
end

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [September 21, 2022, 9:09am UTC](https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540/2 "2022-09-21T09:09:14Z")

</div>

Mh, this is essentially covered in the manual, here [Types · The Julia Language](https://docs.julialang.org/en/v1/manual/types/#Composite-Types)

In your case

```julia
vertices = [@SVector([ 1.5, 0.5]) ]
segments = [@SVector([ 1, 1]) ]
m = Mesh( vertices, segments)
m.vertices[2] == 0.5
# etc...

```

(If you are the person defining the `struct` you could also create helper functions for the construction  
if that is needed in your application.)
