# A Question about struct

**URL:** <https://discourse.julialang.org/t/a-question-about-struct/69582>\
**Category:** General Usage\
**Tags:** question, struct\
**Created:** [October 11, 2021, 7:23pm UTC](https://discourse.julialang.org/t/a-question-about-struct/69582 "2021-10-11T19:23:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![IsraelSI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/israelsi/32/29505_2.png) [@IsraelSI](https://discourse.julialang.org/u/IsraelSI)\
**Post date:** [October 11, 2021, 7:23pm UTC](https://discourse.julialang.org/t/a-question-about-struct/69582/1 "2021-10-11T19:23:03Z")

</div>

Sorry, I’m new to Julia and I have a little conflict with the structures, for example if I have 2 structures corresponding to a polygon and a segment.

```julia
tstruct segment
    first_vertex::Array
    second_vertex::Array
    long::Real
end
struct poligon
    vertex::Union{Array, Array, Array}
    segment::Union{Array, Array, Array}
    perimetrer::Real
    area::Real
end

```

And I would like to make a couple of functions that take as arguments for Segment, the initial vertex and the final vertex of a segment, and for the Polygon function, that take as arguments an array of vertices.  
How i do that?

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [October 11, 2021, 7:31pm UTC](https://discourse.julialang.org/t/a-question-about-struct/69582/2 "2021-10-11T19:31:50Z")

</div>

It’s not clear whether you want to create constructors or functions that operate on the struct data. For the latter, write your function to accept the struct type as an argument, and the function would access the fields of the argument. Also, `Union{Array, Array, Array}` makes no sense. Union means that a variable of the union type may reference a value of any of the parameter types, but these are all the same.
