# MethodError: no method matching -(::VariableRef, ::Nothing)

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126>\
**Category:** General Usage\
**Tags:** question, jump, error\
**Created:** [February 25, 2020, 5:24pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126 "2020-02-25T17:24:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [February 26, 2020, 2:42pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126/2 "2020-02-26T14:42:51Z")

</div>

Take a read of the first post in [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757).

It’s easier to help if you can provide a minimal working example that demonstrates the problem.

The main reason is that your function `lookup` is returning `nothing`. However, the bigger issue is that you cannot use functions like this in a JuMP model. In particular, you are passing the variable `sn[1, t]`, **not** the value of the variable.

You will need to formulate the problem as a mixed integer linear program.

---

_[View the full topic](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126)._
