• Post Reply Bookmark Topic Watch Topic
  • New Topic

help needed on if statements  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys, i am learning if statements but hit a brick wall. is it possible to have two arguments in one if statement e.g. if name is james and age is <= print out "......." ?
 
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, use the && operator instead of and.
 
Knute Snortum
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you can use || for or.
 
Bartender
Posts: 689
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The if statement will work with any expression that evaluates to a boolean, so you can also use method calls that return a boolean.
 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thannkyou guys been a big help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!