"Sputnik" help  
Sputnik Help
Language Reference - Operators - Operator ? : (Boolean Expression True Or False Switch)

Operator ? :

Boolean expression TRUE or FALSE switch. eg.

say 1 == 2 ? "True" : "False";
// PRINTS
// false

// Heres an example of why it looks better
if( $a == 100 )
{
    say "True";
}
else
{
    say "False";
}
// PRINTS
// false

// Is best written like so
say $a == 100 ? "True" : "False";
// PRINTS
// false

Another interesting way to use ? : operator is with the ({ exprs }) brace notice it will allow $cat to increase and yet still return "no" to the argument like:

my $cat = 10;
my $dog = 2;
my $value = $dog == 1 ? "yes" : ({$cat++, "no"});
say "Cat is $cat";
say "Dog is $dog";
say "Value is $value";
// PRINTS
// Cat is 11
// Dog is 2
// Value is no

To see a list of all the operators go here.


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org