# What is causing the error "MethodError: no method matching +(::UnitRange{Int64}, ::Int64)"

**URL:** <https://discourse.julialang.org/t/what-is-causing-the-error-methoderror-no-method-matching-unitrange-int64-int64/60271>\
**Category:** New to Julia\
**Created:** [April 29, 2021, 8:31pm UTC](https://discourse.julialang.org/t/what-is-causing-the-error-methoderror-no-method-matching-unitrange-int64-int64/60271 "2021-04-29T20:31:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)\
**Post date:** [April 29, 2021, 8:31pm UTC](https://discourse.julialang.org/t/what-is-causing-the-error-methoderror-no-method-matching-unitrange-int64-int64/60271/1 "2021-04-29T20:31:16Z")

</div>

In the process of scraping some data from the web, the following code creates an error:

```
  idOpen = findall("""2">""",stringSnippetsI[i])[end]+1

```

The error produced is " **MethodError: no method matching +(::UnitRange{Int64}, ::Int64)**"

When inspecting what I am actually trying to define as idOpen I get

```
  print(typeof(findall("""2">""",stringSnippetsI[i])[1][end]+1))   

```

which is Int64, and more specifically

```
  print(findall("""2">""",stringSnippetsI[i])[1][end]+1)

```

47

What is causing the problem? What am I missing?

---

<div class="post-metadata">

**Author:** ![tkluck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkluck/32/15769_2.png) [@tkluck](https://discourse.julialang.org/u/tkluck)\
**Post date:** [April 29, 2021, 8:42pm UTC](https://discourse.julialang.org/t/what-is-causing-the-error-methoderror-no-method-matching-unitrange-int64-int64/60271/2 "2021-04-29T20:42:25Z")

</div>

If

```julia
print(typeof(<something>))

```

doesn’t give an error, then

```julia
idOpen = <something>

```

also doesn’t give an error. So I think maybe the error is coming from somewhere else in your code, is that possible? Or you edited `<something>` between trying out both?

Maybe this helps you find it: the error indicates that you are trying to add a range (for example, `3:10`) to an integer (for example, `(3:10) + 42`).

---

<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:** [April 29, 2021, 11:16pm UTC](https://discourse.julialang.org/t/what-is-causing-the-error-methoderror-no-method-matching-unitrange-int64-int64/60271/3 "2021-04-29T23:16:47Z")

</div>

> [@Nash](#):
>
> What am I missing?

`[1]`

You have that in the two examples that apparently work, but not in the original.
