Dan had $ w left with him after he bought a candy bar. If he had $ x at the start How much did the candy bar cost?
$w$ - money left after buying a candy bar
$x$ - money at the start
$y$ - cost of a candy bar

$x - y = w$
$x - w = y$

$y = x - w$