# Arithmetic for parametric type values in structs e.g., N+1

**URL:** <https://discourse.julialang.org/t/arithmetic-for-parametric-type-values-in-structs-e-g-n-1/110925>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 28, 2024, 11:37pm UTC](https://discourse.julialang.org/t/arithmetic-for-parametric-type-values-in-structs-e-g-n-1/110925 "2024-02-28T23:37:18Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [February 29, 2024, 3:12am UTC](https://discourse.julialang.org/t/arithmetic-for-parametric-type-values-in-structs-e-g-n-1/110925/4 "2024-02-29T03:12:25Z")

</div>

I would do the following.

```julia
julia> struct Foo{N,M}
           arr1::Array{Float64, N}
           arr2::Array{Float64, M}
           Foo{N}(a,b) where N= new{N, N+1}(a,b)
       end

julia> Foo{1}(rand(2), rand(2,3))
Foo{1, 2}([0.9165330134722103, 0.8133055136507046], [0.15120619990261142 0.8543356012671888 0.5239972992036701; 0.12074486400173157 0.6817097391005016 0.3327645622931258])

```

---

_[View the full topic](https://discourse.julialang.org/t/arithmetic-for-parametric-type-values-in-structs-e-g-n-1/110925)._
