title: Is there a better way to write conditional structures with Elixir since version1.3
body: <p>Elixir 1.3 introduces the deprecation of imperative assignments, meaning that a code block similar to:</p>
  
  <pre><code>def modify(state) do
    if some_condition do
      state = modify_my_state(state)
    end
  
    # some other stuff may happen now here
  
    state
  end
  </code></pre>
  
  <p>Will produce a warning at compile since <code>state</code> is out of scope. This is understandable. But the suggested solution results in this:</p>
  
  <pre><code>def modify(state) do
    state = if some_condition do
      modify_my_state(state)
    else 
      state
    end
  
    # some other stuff may happen now here
  
    state
  end
  </code></pre>
  
  <p>I find it a bit redundant. Is there any other way to make this more clean? Note that the following solution breaks the initial design:</p>
  
  <pre><code>def modify(state) do
    state = if some_condition do
      modify_my_state(state)
    end
  
    # some other stuff may happen now here
  
    state
  end
  </code></pre>