how to use OR in ternary operator code example

Example 1: ternary operator

(condition) ? (if true, do this) : (otherwise, do this)

Example 2: ternary operator

if ($scope.SearchSalesOrderAndCompanyName !== undefined && $scope.SearchSalesOrderAndCompanyName != null ) {
            SearchCriteria += " AND [SalesOrderNo] LIKE '%" + $scope.SearchSalesOrderAndCompanyName + "%' OR ([SO].[CompanyNameOnBill] LIKE '%" + $scope.SearchSalesOrderAndCompanyName + "%')";
        }
        if ($scope.FromDate !== undefined && $scope.FromDate !=null) {
            SearchCriteria += " AND [SO].[SalesOrderDate] LIKE '%" + $scope.FromDate + "%'";
        }

Example 3: How many operands does a ternary operator have?

<?php
$i = 0;
while ((--$i > ++$i) - 1)
{   
    print $i;
}
?><?php
$i = 2;
while (++$i)
{   
    while ($i-- > 0)
        print $i;
}
?>

Tags:

Misc Example