sam lehman wrote:
> so would:
> something ? dosomething : somethingelse ? dosomethingelse : killyourself
> be the same as
Let's not go there--at least not yet. NOt that I object to suicide
particularly, y'know "dff'runt strokes fer diff'runt folks" an' all, but nesting
conditionals before you h
On Thu, 11 Mar 2004 11:07:24 +0100, Ralf Schaa <[EMAIL PROTECTED]>
wrote:
sam lehman wrote:
i got his code from a program i found, and i was wondering that the ?
and the : are for?
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
conditional statement (with low
Hi,
sam lehman <[EMAIL PROTECTED]> asked:
> i got his code from a program i found, and i was wondering
> that the ? and
> the : are for?
>
> $target = (@digits % 2) ? ($digits[int(@digits/2)]) :
> ([EMAIL PROTECTED]/2-1]);
This is the so-called ternary operator. It's roughly
equal to saying
Yes excuse my typo!!!
Remo Sanges
On Mar 11, 2004, at 11:37 AM, Ralf Schaa wrote:
Remo Sanges wrote:
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
if ($target = (@digits % 2)) {
($digits[int(@digits/2)]);
}
else {
([EMAIL PROTECTED]/2-1]);
}
isn't it
Sam Lehman wrote:
>
> i got his code from a program i found, and i was wondering that the ? and
> the : are for?
>
> $target = (@digits % 2) ? ($digits[int(@digits/2)]) :
> ([EMAIL PROTECTED]/2-1]);
Others have explained what ?: is but you could write that more simply
as:
my $target = $digits[
Remo Sanges wrote:
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
if ($target = (@digits % 2)) {
($digits[int(@digits/2)]);
}
else {
([EMAIL PROTECTED]/2-1]);
}
isn't it like this?
condition is (@digits % 2) : when the modulo is 1 then $target=
($digits
On Mar 11, 2004, at 6:07 AM, sam lehman wrote:
i got his code from a program i found, and i was wondering that the ?
and the : are for?
It is a contracted form for 'if'... 'else'
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
if ($target = (@digits % 2)) {
sam lehman wrote:
i got his code from a program i found, and i was wondering that the ?
and the : are for?
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
conditional statement (with lower priority than an 'if-construct' ?):
if (@digits % 2) {
$target = ($dig
i got his code from a program i found, and i was wondering that the ? and
the : are for?
$target = (@digits % 2) ? ($digits[int(@digits/2)]) :
([EMAIL PROTECTED]/2-1]);
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For ad