[chuck-users] comma is and? undocumented feature

Jukka Akkanen jakkanen at mac.com
Sat Jun 28 15:14:34 EDT 2008


This seems to be similar to the comma operator in C, which lets you  
use multiple comma-separated sub-expressions in a context where only a  
single expression is allowed. An expression using the comma operator  
evaluates to the value of the last sub-expression. Note that the comma  
operator is very different from how && works.

-Jukka

On Jun 28, 2008, at 10:57 AM, Kassen wrote:

> Dear list,
>
> Consider the following;
> ===============
> if( 1 , 0)
>     {
>     <<<"false?">>>;
>     }
>
> if( 1 , 1)
>     {
>     <<<"true?">>>;
>     }
> =============
>
> I think this isn't according to the language specs but it runs just  
> fine. It seems that the comma equates to "&&"? it's not problematic  
> in the slightest but it's not according to the specs either, I  
> think, and a bit confusing.
>
> What's up here?
>
> Yours,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list