Re: how return false or value?

2019-11-08 Thread ingo
Actually solved it in a different way, created an enum to pass meaningful information to the next proc. type Intersection = enum intersect, parallel, zerolength, notsegment proc lintersect(p1, .): (Intersection, Vec2) = ...

Re: how return false or value?

2019-11-08 Thread ingo
Ah. I'll have a go at it. Thanks.

Re: how return false or value?

2019-11-08 Thread foldl
Oh, this remind me of Maybe in Haskell. Excellent.

Re: how return false or value?

2019-11-08 Thread kaushalmodi
Have a look at [https://nim-lang.github.io/Nim/options](https://nim-lang.github.io/Nim/options) .

how return false or value?

2019-11-08 Thread ingo
some of my procs can have no result so I'd like them to return false or a value. For now I have proc lintersect(p1, p2, p3, p4: Vec2, segments=false): (bool, Vec2) = . if parallel return (false, vec2(0,0)) . . return (true, vec2(x,y)) Run