Go to Post Do not treat Vex and FLL as inferior because they may not get as much exposure as FRC on these boards. Just remember, FLL has seven times more teams than FRC from twenty additional countries. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
View Poll Results: Do you use Ternary Operators in your code?
Yes 17 60.71%
No 11 39.29%
Voters: 28. You may not vote on this poll

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 06-04-2004, 20:52
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Do you use ternary operators in your code?

Quote:
Originally Posted by JJG13
I try to do whatever is most readable but instead of
Code:
if (y > 5)
  x = 1;
else
  x = 0;
I would use
Code:
x = (y > 5);
yes, just remember that not all compilers treat logical TRUE as 1. it's fine to use it as long as you know it works. more robust, however, is the ternary:
Code:
x = y > 5 ? 1 : 0;
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is your most prefered programming language? Hailfire Programming 156 19-01-2005 21:42
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Interrupt timer, executing code asap? SeanCassidy Programming 10 07-03-2004 01:47
Inserting Naviagation code into Default code? actorindp Programming 3 28-01-2004 18:12
Does your team use the Default code. Jeff McCune General Forum 2 09-01-2003 14:46


All times are GMT -5. The time now is 09:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi