Checking BUTTON checks the current state.
Checking B checks the state it was at, at the moment you set B=BUTTON.
Have a look at this screenshot. It's a simple way to wait until button A is pressed. Notice we first wait until no buttons are pressed. This prevents a previous continued press of A from making this code flow through without waiting for a new press of A.

プレイ済み