Ternary Operator


examples/scalars/ternary.p6
use v6;

my $age = 42;

if $age > 18 {
	say "Above 18";
} else {
	say "Below 18";
}

say $age > 18 ?? "Above 18" !! "Below 18";


COND ?? VALUE_IF_TRUE !! VALUE_IF_FALSE

Copyright 2006, 2007, 2008, 2009, 2010 Gabor Szabo http://szabgab.com/ Index | TOC
If you are interested in on-site trainings by the author, please contact me directly.

Online courses: