chapter  7
In tip-top condition
Pages 21

Should I go to Barcelona at Easter? If I have the money, there are flights available and I can get a hotel, then I’ll go. Life is full of decisions. Should I take that job? Should I join a gym? Should I make a cup of tea? Whenever you make a decision, you will consider a number of options and in the end you will either decide to do something or you will choose not to. As you embark on your programming career you may be thinking if this doesn’t get any easier then I stick to producing artwork. In this chapter we look at making decisions in your programs using the marvellous ‘if’ statement. An ‘if’ statement takes a logical argument that resolves to true or false; none of the difficult in-between concepts for a computer, it’s either true or it’s false and no half measures. Sometimes we need to combine several decisions before we come to our final conclusion. Multiple decisions are handled using Boolean logic, which is introduced in this chapter. We will illustrate some of these concepts using a keyboard controlled walking bucket and some very attractive lights. So without further ado let us set sail on the sea of conditions.