Valves ensure that blood does not flow backwards when the ventricles contract, i.e. it ensures that the blood flows only in one direction.