# Declaring just one variable as integer

**URL:** <https://discuss.ampl.com/t/declaring-just-one-variable-as-integer/1969>\
**Category:** Support\
**Created:** [November 1, 2024, 12:06pm UTC](https://discuss.ampl.com/t/declaring-just-one-variable-as-integer/1969 "2024-11-01T12:06:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [November 4, 2024, 3:57pm UTC](https://discuss.ampl.com/t/declaring-just-one-variable-as-integer/1969/2 "2024-11-04T15:57:55Z")

</div>

See [How do I relax the integrality of only some of a model’s integer variables?](https://discuss.ampl.com/t/how-do-i-relax-the-integrality-of-only-some-of-a-model-s-integer-variables/48) in our Frequently asked questions. Also, there is an example in a recent post about [Relaxing integrality on specific index values of a variable](https://discuss.ampl.com/t/relaxing-integrality-on-specific-index-values-of-a-variable/1959).

For your example, you could define

```auto
var x {i in 1..n} integer >= 0;

```

and then use these statements to say that `x[4]` must be an integer that is `>=5`:

```auto
let {i in 1..n} x[i].relax := (if i = 4 then 0 else 1);
subject to LowerBound: x[4] >= 5;

```

---

_[View the full topic](https://discuss.ampl.com/t/declaring-just-one-variable-as-integer/1969)._
