# I'm getting a ParseError and I dont know why

**URL:** <https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 24, 2025, 3:35pm UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627 "2025-09-24T15:35:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Queenvictoria](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/queenvictoria/32/218740_2.png) [@Queenvictoria](https://discourse.julialang.org/u/Queenvictoria)\
**Post date:** [September 24, 2025, 3:35pm UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/1 "2025-09-24T15:35:31Z")

</div>

I’m writing a function and I keep getting this error message:

```julia-auto
LoadError: ParseError:
# Error @ ./mixed-juices.jl:52:14
   if length(orders) < 1
# ┌───────
       time left = 0
   end
#──┘ ── Expected `end`

```

What am I doing wrong??? I added an ‘end’ where its needed??? New to Julia please help.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [September 24, 2025, 3:37pm UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/2 "2025-09-24T15:37:54Z")

</div>

Perhaps you forgot an underscore?

This works fine:

```julia-auto
julia> if length(orders) < 1
           time_left=0
       end

```

---

<div class="post-metadata">

**Author:** ![Queenvictoria](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/queenvictoria/32/218740_2.png) [@Queenvictoria](https://discourse.julialang.org/u/Queenvictoria)\
**Post date:** [September 24, 2025, 3:42pm UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/3 "2025-09-24T15:42:03Z")

</div>

Ph yeah thanks

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 25, 2025, 8:15am UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/4 "2025-09-25T08:15:39Z")

</div>

For my own edification is this part of the error message:

```julia-auto
# ┌───────
       time left = 0
   end
#──┘ ── Expected `end`

```

saying “the `end` at the right end of the square bracket was expected at the left end of that bracket, i.e. after `time`”?

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [September 25, 2025, 9:03am UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/5 "2025-09-25T09:03:40Z")

</div>

It’s clearer with colour (and without Discourse text formatting screwing up the alignment a bit) I think:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/6/a679e7456bf83546a13fc703c6ba6e4e19088815.png)

It’s marking that part of the code as unexpected.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 25, 2025, 9:25am UTC](https://discourse.julialang.org/t/im-getting-a-parseerror-and-i-dont-know-why/132627/6 "2025-09-25T09:25:27Z")

</div>

Ah right, the bracket doesn’t actually end on the `end` - makes sense, thanks.
