Science Fair Projects Ideas - ?:

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

?:

?: is a noted example of a ternary operator, which is part of the syntax for a basic conditional expression in C, C++, Perl, Ruby, PHP, JavaScript and Java. It is often used in conditional assignment statements.

This ternary operator is used in an expression as follows

condition ? value if true : value if false 

The condition is evaluated true or false as a Boolean expression. On the basis of the evaluation of the Boolean condition, the entire expression returns value if true if condition is true, but value if false otherwise.

This ternary operator's usage is to minimize the amount of code used for a simple conditional assignment statement. (In this case, the expression is converted into a statement by appending a semicolon ; to the expression.) For example, if we wish to implement some C code to change a shop's opening hours to 12 o'clock in weekends, and 9 o'clock on weekdays, we may use

 int opening_time = (day == WEEKEND) ? 12 : 9;

instead of the more verbose

 int opening_time;
 if(day == WEEKEND)
     opening_time = 12;
 else
     opening_time = 9;

The two forms are equivalent. Note that neither value if true nor value if false expressions can be omitted from the ternary operator without an error report upon parsing.

Last updated: 05-22-2005 00:41:31
10-26-2009 08:16:03
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice