Hi,
I was wondering what the correct syntax would be if i only wanted a returned value for true or false using the Ternary operator.
IE. if true give value otherwise don't or if false give value otherwise don't
I currently have
can you omit the 'else' ) colon part so just have...
It would be good and better than using
Or would this be better...
Your advice is appreciated.
1DMF.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
I was wondering what the correct syntax would be if i only wanted a returned value for true or false using the Ternary operator.
IE. if true give value otherwise don't or if false give value otherwise don't
I currently have
Code:
my $prod_type = $case->{'LoanType'} . ($case->{'LoanTypeSecondary'} == -1) ? '' : $case->{'LoanTypeSecondary'};
can you omit the 'else' ) colon part so just have...
Code:
my $prod_type = $case->{'LoanType'} . ($case->{'LoanTypeSecondary'} != -1) ? $case->{'LoanTypeSecondary'};
It would be good and better than using
Code:
my $prod_type = $case->{'LoanType'};
if ($case->{'LoanTypeSecondary'} != -1){
$prod_type .= $case->{'LoanTypeSecondary'};
}
Or would this be better...
Code:
my $prod_type = $case->{'LoanType'};
$prod_type .= $case->{'LoanTypeSecondary'} if $case->{'LoanTypeSecondary'} != -1;
Your advice is appreciated.
1DMF.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts