Re: can somebody tell me what this means

2004-03-12 Thread R. Joseph Newton
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

Re: can somebody tell me what this means

2004-03-12 Thread sam lehman
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

RE: can somebody tell me what this means

2004-03-11 Thread Thomas Bätzler
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

Re: can somebody tell me what this means

2004-03-11 Thread Remo Sanges
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

Re: can somebody tell me what this means

2004-03-11 Thread John W. Krahn
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[

Re: can somebody tell me what this means

2004-03-11 Thread Ralf Schaa
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

Re: can somebody tell me what this means

2004-03-11 Thread Remo Sanges
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)) {

Re: can somebody tell me what this means

2004-03-11 Thread Ralf Schaa
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

can somebody tell me what this means

2004-03-11 Thread sam lehman
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