Skip to content

Commit

Permalink
fix indentation; add explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshay Sharma committed Mar 30, 2020
1 parent 202994e commit 2df1f15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/src/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,7 @@ julia> start_value(y)

## [The `@variables` macro](@id variables)

If you have many [`@variable`](@ref) calls, JuMP provides the macro `@variables`
that can improve readability:
If you have many [`@variable`](@ref) calls, JuMP provides the macro [`@variables`](@ref) that can improve readability:

```jldoctest; setup=:(model=Model())
julia> @variables(model, begin
Expand All @@ -764,6 +763,7 @@ Subject to

```@docs
@variable
@variables
owner_model
VariableRef
all_variables
Expand Down
11 changes: 7 additions & 4 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,9 @@ end
adds groups of constraints at once, in the same fashion as @constraint. The model must be the first argument, and multiple constraints can be added on multiple lines wrapped in a `begin ... end` block. For example:
@constraints(m, begin
x >= 1
y - w <= 2
sum_to_one[i=1:3], z[i] + y == 1
x >= 1
y - w <= 2
sum_to_one[i=1:3], z[i] + y == 1
end)
""" :(@constraints)

Expand All @@ -656,10 +656,13 @@ adds groups of constraints at once, in the same fashion as @constraint. The mode
Adds multiple variables to model at once, in the same fashion as `@variable` macro. The model must be the first argument, and multiple variables can be added on multiple lines wrapped in a `begin ... end` block. For example:
@variables(m, begin
x
x
y[1:2] >= 0
z, Bin, (start = 0)
end)
!!! note
Keyword arguments must be contained within parentheses (refer the example above).
""" :(@variables)

"""
Expand Down

0 comments on commit 2df1f15

Please sign in to comment.