I’m not quite sure what your question is, but the second example won’t work as you expect it, as this is what we call an imperative assignment which have been deprecated for a long time and removed in 1.8.
But the most idiomatic version were to use an if here. unless with an else is often discouraged. Most often it’s just used for side effects in negative cases.
alive = if sender in state.alive, do: state.alive, else: [sender | state.alive]
Which version was in the book? The first or the second? And which book was it?
And as I said, prior to 1.8 both versions should have printed the same, but the second should have given a warning at compile time. Since 1.8, there will be no visible effect from the inner assignment in the outer scope.