# UndefVarError

**URL:** https://discourse.julialang.org/t/undefvarerror/17637
**Category:** New to Julia
**Tags:** question
**Created:** [November 17, 2018, 10:23am UTC](https://discourse.julialang.org/t/undefvarerror/17637 "2018-11-17T10:23:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![marouane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marouane/32/16267_2.png) [@marouane](https://discourse.julialang.org/u/marouane)
#### Post date: [November 17, 2018, 10:23am UTC](https://discourse.julialang.org/t/undefvarerror/17637/1 "2018-11-17T10:23:28Z")

</div>

Hello Everyone ,  
i have been struggling with a program that doesn’t want to run on Julia version 0.7, this is the Program:

```julia
struct OrthoNNDist <: DiscreteMultivariateDistribution
	x0::Vector{Int64}
	oc::Array{Int64,2}
	x1s::Array
	prob::Float64
    #return a new uniform distribution with all vectors in x1s orthogonal to oc
	function OrthoNNDist(x0::Vector{Int}, oc::Array{Int,2})
		x1s = []
		for i = 1:size(oc)[2]
			x1 = x0 + oc[:, i]
			if nonneg(x1)
				push!(x1s, x1)
			end
			x1 = x0 - oc[:, i]
			if nonneg(x1)
				push!(x1s, x1)
			end
		end
		new(x0, oc, x1s, 1.0/length(x1s))
	end
end

Base.length(d::OrthoNNDist) = length(d.x0)

Distributions.rand(d::OrthoNNDist) = rand(d.x1s)

Distributions.pdf(d::OrthoNNDist, x::Vector) = x in d.x1s ? d.prob : 0.0
Distributions.pdf(d::OrthoNNDist) = fill(d.prob, size(d.x1s))
Distributions.logpdf(d::OrthoNNDist, x::Vector) = log(pdf(d, x))

```

and it shows me always UndefVarError: DiscreteMultivariateDistribution not defined

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 17, 2018, 10:28am UTC](https://discourse.julialang.org/t/undefvarerror/17637/2 "2018-11-17T10:28:34Z")

</div>

Probably you are missing

```julia
using Distributions

```

Please [quote your code](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

---

<div class="post-metadata">

### Author: ![marouane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marouane/32/16267_2.png) [@marouane](https://discourse.julialang.org/u/marouane)
#### Post date: [November 17, 2018, 3:29pm UTC](https://discourse.julialang.org/t/undefvarerror/17637/3 "2018-11-17T15:29:58Z")

</div>

yeah you are right how can i do such mistake im still a beginner in Julia, it worked anyway thanks. But i still have Problems with Structures and Types i can’t know the exact difference between them and their type like abstract or concrete types or mutable and immutable…

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 17, 2018, 3:39pm UTC](https://discourse.julialang.org/t/undefvarerror/17637/4 "2018-11-17T15:39:00Z")

</div>

> [@marouane](#):
>
> But i still have Problems with Structures and Types i can’t know the exact difference between them and their type like abstract or concrete types or mutable and immutable…

The [manual](https://docs.julialang.org/en/v1/manual/types/) may help.
