Justice wrote:
> On Mar 11, 1:19 am, Triple-DES <DenPlettf...@[EMAIL PROTECTED]
> wrote:
>
>>On 10 Mar, 19:33, Justice <foi...@[EMAIL PROTECTED]
> wrote:> I am trying to make
a simple game but have some problems
>>
>>[snip]
>>
>>I think you are confusing "=" and "==". For instance:
>>
>> if (Buy='y')
>>
>>Should probably be:
>>
>> if(Buy == 'y')
>>
>>etc.
>>DP
>
>
> oh yes I noticed that bug after I compiled and ran it, It's takeing a
> bit for my brain to unlearn that = does not mean =, == equals =, but
> thanks
> This is really my first program of usefullness
The compiler can help you a little here, if you make a habit of always
writing a constant on the left-hand-side of any boolean expression (when
possible)
for example, if( buy == 'y' ) would become
if( 'y' == buy )
This way, if you accidentally typed a single = symbol (known as the
assignment operator), the compiler would complain that you cannot assign
something to 'y'. Compiler errors are a very good thing, since they
help you eliminate would-be bugs from your program


|