• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

If statements not working

 
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 3 if's in a row and the variable PTpe is tested against the values 1, 2 and 3 (in that order)
so it should choose the if statement with the appropriate value

However it ALLWAYS NO MATTER WHAT chosses ALL the if statements even thought it is not possible for the if test to be true with all 3
I will attach a picture that demonstrates everything
How could this be?
A bigger image

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at your second and third if statements (lines 14 and 19). They both have a character that they shouldn't have.
 
Stephen Black
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok that was a STUPID mistake for me to make (I said as I slapped myself in the head)
Thanks for your help

Matthew Brown wrote:Have a look at your second and third if statements (lines 14 and 19). They both have a character that they shouldn't have.

 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a stupid mistake. Everybody makes that mistake when they are beginning.
 
Stephen Black
Ranch Hand
Posts: 52
1
MySQL Database Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the future please post the code in code tags rather than posting an image which is not searchable.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did this 3 weeks ago, after 8 hours straight of hair pulling and head bashing I changed the if statement to hit launch, and it still did it. That is when I saw that ... ... semicolon.

I feel much less stupid after seeing your post, I truly hope you spent less time looking for the problem than I did.
reply
    Bookmark Topic Watch Topic
  • New Topic