• Post Reply Bookmark Topic Watch Topic
  • New Topic

Nested Conditional St  RSS feed

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to spilt the following nested conditional statement. It's vary confusing.


[ August 17, 2005: Message edited by: Mark Henryson ]
 
Ranch Hand
Posts: 1143
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Henryson:
How to spilt the following nested conditional statement. It's vary confusing.


The first question is whether you know what the ?: operator does.

Next, what is the value of (b=!b)?

Finally, can you convert the given ?: expression to a nested if/else structure? Once you do that, what does the code look like? What would the resulting output be?
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try writing it using if...else statements first until you get it working. You can make it obscure later

Are you sure you want your test to be b=!b ? This is an assignment statement which will always return true.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!