# Style guide: in or =

**URL:** <https://discourse.julialang.org/t/style-guide-in-or/31155>\
**Category:** Optimization (Mathematical)\
**Tags:** question, documentation, jump\
**Created:** [November 16, 2019, 2:52pm UTC](https://discourse.julialang.org/t/style-guide-in-or/31155 "2019-11-16T14:52:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![remi-garcia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/remi-garcia/32/7125_2.png) [@remi-garcia](https://discourse.julialang.org/u/remi-garcia)\
**Post date:** [November 16, 2019, 2:52pm UTC](https://discourse.julialang.org/t/style-guide-in-or/31155/1 "2019-11-16T14:52:03Z")

</div>

Hi,  
JuMP’ style guide states we should prefer `in` over `=` in for loops: [Style Guide · JuMP](http://www.juliaopt.org/JuMP.jl/stable/style/#for-loops-1)  
I was wondering why it is not the same for variables and constraints declaration as in the documentation we can find `@variable(model, x[i=1:4; mod(i, 2)==0])` instead of `@variable(model, x[i in 1:4; mod(i, 2)==0])`. Is there a reason for choosing `=` in this case?  
Thank you  
Rémi Garcia

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [November 17, 2019, 2:48am UTC](https://discourse.julialang.org/t/style-guide-in-or/31155/2 "2019-11-17T02:48:29Z")

</div>

Good question, I don’t think we’ve explicitly considered this, but I agree that it should be covered by the JuMP style guide. My initial response is that `in` (with required spaces before and after) is 4x as many characters as `=`. It’s common to have multiple indices like this for a variable, e.g., `@variable(model, x[i=1:N, j=1:N, k=1:N])`, so the effect of the extra characters is may be more significant than for regular `for` loops.

See also the discussion at [https://github.com/domluna/JuliaFormatter.jl/pull/70](https://github.com/domluna/JuliaFormatter.jl/pull/70).

---

<div class="post-metadata">

**Author:** ![remi-garcia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/remi-garcia/32/7125_2.png) [@remi-garcia](https://discourse.julialang.org/u/remi-garcia)\
**Post date:** [November 17, 2019, 7:58am UTC](https://discourse.julialang.org/t/style-guide-in-or/31155/3 "2019-11-17T07:58:30Z")

</div>

I understand your point, thanks!

I’ve always few constraints that have too many characters anyway. Hence I have to add breaks after the indices and a few characters are not a problem. Thanks for the link to the discussion, that was really interesting too.
