Do you think if statement as expression would be nice to have in D?

zjh fqbqrr at 163.com
Sat Jun 4 06:33:00 UTC 2022


On Saturday, 4 June 2022 at 02:24:41 UTC, monkyyy wrote:

> ```swift
> let point = CGPoint(x: 7, y: 0)
> switch (point.x, point.y) {
>   case (0,0): print("On the origin!")
>   case (0,_): print("x=0: on Y-axis!")
>   case (_,0): print("y=0: on X-axis!")
>   case (let x, let y) where x == y: print("On y=x")
>   default: print("Quite a random point here.")
> }
> ```
> https://alisoftware.github.io/swift/pattern-matching/2016/03/30/pattern-matching-2/
> this would be an example of what I expect.


I think it's worth it. The more features, the better!
Yes ,We are C++++!




More information about the Digitalmars-d mailing list