# Syntax suggestion: end\<control\>

**URL:** https://discourse.julialang.org/t/syntax-suggestion-end-control/8605
**Category:** Internals & Design
**Created:** [January 26, 2018, 12:26am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605 "2018-01-26T00:26:49Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![NaOH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naoh/32/5632_2.png) [@NaOH](https://discourse.julialang.org/u/NaOH)
#### Post date: [January 26, 2018, 1:23am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/2 "2018-01-26T01:23:50Z")

</div>

You could do something like this, just as a proof of concept (not taking `elseif`/`else` branches into account), similar macros could be done for the other type of blocks:

```julia
julia> @eval macro $(:if)(condition, expression, terminator::Symbol)
           terminator ≠ :endif && error()
           quote
               if $condition
                   $expression
               end
           end |> esc
       end
@if (macro with 1 method)

julia> x = 42
42

julia> @if x == 42 (
           info("yep!")
       ) endif
INFO: yep!

julia> @macroexpand @if x == 42 (
           info("yep!")
       ) endif
quote # REPL[9], line 4:
    if x == 42 # REPL[9], line 5:
        info("yep!")
    end
end

```

But then again in Julia a lot of control nesting can become a lot of multiple dispatch instead, I would refactor such a long `if` block. In Julia you can have pretty much any syntax you like and in a package.

I just wish there where some kind of macro line continuation syntax or semantics, but the parenthesis do the job here (instead of a `begin ... end`, which would defeat the purpose of the trailing `endif`).

Also you could always do:

```julia
if (a=b)
   continue
end # if

```

😛

---

_[View the full topic](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605)._
