# An error in implementation of "for" loop while using "IntervalArithmetic.jl" package in "Pluto.jl" notebook

**URL:** <https://discourse.julialang.org/t/an-error-in-implementation-of-for-loop-while-using-intervalarithmetic-jl-package-in-pluto-jl-notebook/93523>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 25, 2023, 6:06pm UTC](https://discourse.julialang.org/t/an-error-in-implementation-of-for-loop-while-using-intervalarithmetic-jl-package-in-pluto-jl-notebook/93523 "2023-01-25T18:06:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kanishk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kanishk/32/46224_2.png) [@Kanishk](https://discourse.julialang.org/u/Kanishk)\
**Post date:** [January 25, 2023, 6:06pm UTC](https://discourse.julialang.org/t/an-error-in-implementation-of-for-loop-while-using-intervalarithmetic-jl-package-in-pluto-jl-notebook/93523/1 "2023-01-25T18:06:03Z")

</div>

Hello

I am trying to find a root of an equation using Interval Newton method in Julia. I am using “IntervalArithmetic.jl” package in “Pluto.jl” notebook. The code seems logically correct (checked a few times) but it is giving an error `syntax: "for" at /Users/dycobs/.julia/pluto_notebooks/Mini revelation.jl#==#4e903eeb-0172-4cd3-b5e9-21d235f99d28:13 expected "end", got "NXk"`  
The code is here

```julia
begin
using IntervalArithmetic, Plots, ForwardDiff, PlutoUI, FiniteDiff

	f(x) = a - b * x
	
	l = 10   
	m = 10
	a1 = vec(mince(100..200, l))
	b1 = vec(mince(1..2, m))
	
	d(f, x) = ForwardDiff.derivative(f, x) 
	local Xnew = 0..300
	nn = 10 
	NXk = (0..0)
	for i in 1:nn
		for j in 1:l
			a = a1[j]
			for k in 1:m
				b = b1[k]
				NXk_new = mid(Xnew) - (f(mid(Xnew)) / d(f, Xnew))
				NXk = NXk ∪ NXk_new
			end
		end
		Xkplus NXk ∩ Xnew
		Xnew = Xkplus
		@show(interval(i), Xnew)
	end
end

```

Could you please explain the possible reason behind the error?

Thank you

---

<div class="post-metadata">

**Author:** ![cvanaret](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cvanaret/32/11594_2.png) [@cvanaret](https://discourse.julialang.org/u/cvanaret)\
**Post date:** [January 25, 2023, 6:11pm UTC](https://discourse.julialang.org/t/an-error-in-implementation-of-for-loop-while-using-intervalarithmetic-jl-package-in-pluto-jl-notebook/93523/2 "2023-01-25T18:11:24Z")

</div>

> [@Kanishk](#):
>
> `Xkplus NXk ∩ Xnew`

Something’s missing here 😉
