I suggest you first glance through the Harlowe 2.x manual, in particular the sections on the (set:) macro (variable creation) and the (if:) macro (conditional expresions). You may also want to look through the Harlowe related recipes within the Twine Cookbook, the Conditional Statements recipe has information related to question.
General information about creating a Twine Story can be found in the Twine 2.x section of the Twine WIki.