This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Question  RSS feed

 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very basic question about syntax, embarrassed to ask, but I forget
the answer, and don't have my references here. I believe this is
a question fitting for this forum.
Consider the following code fragment:


This can be accomplished in a single line, something like:

Can someone help me?

Thanx
Don
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the ? : operator.
[ June 26, 2004: Message edited by: chi Lin ]
 
Greg T Robertson
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be more precise it's
 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!