Correction. My example reused "val" This is what I should have typed:

*    let foo = *
*        "positive" where ( bar > 0 )  ?? *
*        "negative" where ( bar < 0 ) ?? *
*        "zero"*

Sorry for that. My mind seems to switch itself off whenever I submit to
this list :)

Also, since my previous posts to this list about ternary and switch
assignment, etc. I now feel that including the variable name in the bool
side is useful. It would be a quick way to do the following sort of thing:

*    let foo = *
*        "positive" where ( bar > 0 )  ?? *
*        "negative" where ( bar < 0 ) ?? *
*        "animal zero" where ( is_animal == true ) ?? *
*        "normal zero"*
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to