I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
I tried also
userCredential.flagged? ? return (-1) : return 1
same problem.....
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
I tried also
userCredential.flagged? ? return (-1) : return 1
same problem.....
This seems to work:
return userCredentials.flagged? ? -1 : 1
Farrel
On 15/01/07, Josselin <josselin@wanadoo.fr> wrote:
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
I tried also
userCredential.flagged? ? return (-1) : return 1
same problem.....
Josselin wrote:
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
You mean
return userCredential.flagged? -1 : 1
?
I am not sure in Ruby, but if it's the same than in C or anywhere else, the ternary operator evaluates to a value, and you can not really execute things like this inside...
Cheers,
Peter
__
http://www.rubyrailways,com
Hi,
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
when saying
userCredential.flagged? ? (return -1) : (return 1)
or even
userCredential.flagged? ? begin return -1 end : begin return 1 end
you will probably see that the return statement is definitely in the
wrong place.
Bertram
Am Montag, 15. Jan 2007, 20:30:08 +0900 schrieb Josselin:
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
Hi,
At Mon, 15 Jan 2007 20:30:08 +0900,
Josselin wrote in [ruby-talk:234078]:
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
Because `return' is a statement. In Ruby, a "statement" is
defined as an expression which has lower precedence and can't
appear directly in another expression.
--
Nobu Nakada
thanks a lot first time I was using this kind of return... ;-))
On 2007-01-15 12:43:21 +0100, Peter Szinek <peter@rubyrailways.com> said:
Josselin wrote:
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
You mean
return userCredential.flagged? -1 : 1
?
I am not sure in Ruby, but if it's the same than in C or anywhere else, the ternary operator evaluates to a value, and you can not really execute things like this inside...
Cheers,
Peter__
http://www.rubyrailways,com
hanks a lot first time I was using this kind of return... ;-))
On 2007-01-15 12:41:09 +0100, "Farrel Lifson" <farrel.lifson@gmail.com> said:
On 15/01/07, Josselin <josselin@wanadoo.fr> wrote:
I got the following error :
parse error, unexpected tUMINUS_NUM
userCredential.flagged? ? return -1 : return 1
what's wrong ?
I tried also
userCredential.flagged? ? return (-1) : return 1
same problem.....
This seems to work:
return userCredentials.flagged? ? -1 : 1
Farrel
This seems to work though
userCredentials.flagged? ? (return -1) : (return 1)
Farrel
On 15/01/07, Peter Szinek <peter@rubyrailways.com> wrote:
Josselin wrote:
> I got the following error :
>
> parse error, unexpected tUMINUS_NUM
>
> userCredential.flagged? ? return -1 : return 1
You meanreturn userCredential.flagged? -1 : 1
?
I am not sure in Ruby, but if it's the same than in C or anywhere else,
the ternary operator evaluates to a value, and you can not really
execute things like this inside...Cheers,
Peter