Is there any function to tell if a number is even or odd?
I am looking for an easy way to loop through a list and
output table cell bgcolor based on even / odd.
if its an even numbered row make it red if its odd make
it blue.
I have done it in the past by turning a switch on or off
but
Zachary Buckholz wrote:
Is there any function to tell if a number is even or odd?
I am looking for an easy way to loop through a list and
output table cell bgcolor based on even / odd.
if its an even numbered row make it red if its odd make
it blue.
$_ % 2 ? print blue\n : print red\n
PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Original Message -
From: Sudarsan Raghavan [EMAIL PROTECTED]
To: Zachary Buckholz [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 05, 2002 5:01 PM
Subject: Re: probably a simple question
Zachary Buckholz wrote
-Original Message-
From: Zachary Buckholz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 10:11 PM
To: [EMAIL PROTECTED]
Subject: probably a simple question
Is there any function to tell if a number is even or odd?
I am looking for an easy way to loop through a list and
$_ % 2 ? print blue\n : print red\n foreach (@your_list);
This actually works?! Very strange notation, how does the compiler see
this line? I assume the mod operator evaluates to 1-true or 0-false, what
does the ? do? What does the : do? How do you have a foreach at the
end of a line
PROTECTED]]
Sent: Wednesday, June 05, 2002 1:52 PM
To: [EMAIL PROTECTED]
Subject: Re: probably a simple question
$_ % 2 ? print blue\n : print red\n foreach (@your_list);
This actually works?! Very strange notation, how does the
compiler see
this line? I assume the mod operator
, June 05, 2002 10:52
To: [EMAIL PROTECTED]
Subject: Re: probably a simple question
$_ % 2 ? print blue\n : print red\n foreach (@your_list);
This actually works?! Very strange notation, how does the compiler see
this line? I assume the mod operator evaluates to 1-true or 0-false, what
does
Bryan R Harris wrote at Wed, 05 Jun 2002 19:51:49 +0200:
$_ % 2 ? print blue\n : print red\n foreach (@your_list);
This actually works?! Very strange notation, how does the compiler see this line?
I assume the
mod operator evaluates to 1-true or 0-false, what does the ? do? What does
: print red\n }
-Original Message-
From: Bryan R Harris [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 1:52 PM
To: [EMAIL PROTECTED]
Subject: Re: probably a simple question
$_ % 2 ? print blue\n : print red\n foreach (@your_list);
This actually works?! Very strange