# Defining @ constraint with IntervalConstraintProgramming

**URL:** <https://discourse.julialang.org/t/defining-constraint-with-intervalconstraintprogramming/120884>\
**Category:** General Usage\
**Created:** [October 4, 2024, 5:19am UTC](https://discourse.julialang.org/t/defining-constraint-with-intervalconstraintprogramming/120884 "2024-10-04T05:19:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ij05](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ij05/32/209328_2.png) [@ij05](https://discourse.julialang.org/u/ij05)\
**Post date:** [October 4, 2024, 5:19am UTC](https://discourse.julialang.org/t/defining-constraint-with-intervalconstraintprogramming/120884/1 "2024-10-04T05:19:23Z")

</div>

I am trying to define a constraint using the IntervalConstraintProgramming.jl package as follows:

```julia
a=3
C = @constraint x^2 + y^2 - $a <= 0

```

Here, I wanted x and y to be treated as variables and a as a constant, defined elsewhere. But I get the following error:

```julia
UndefVarError: `a` not defined

Stacktrace:
 [1] top-level scope
   @ C:\Users\user\.julia\packages\IntervalConstraintProgramming\8OYsb\src\separator.jl:156

```

If I remove the ‘$’ before a, I get:

```julia
Separator:
  - variables: x, y, a
  - expression: (x ^ 2 + y ^ 2) - a ∈ [-∞, 0]

```

But here, a is also treated as a variable, which is not what I wanted. Any help would be deeply appreciated. Thanks in advance!
