1. Quick Question About Short-Circuit Evaluation
- Posted by Icy_Viking 2 months ago
- 512 views
Is this how you'd do Short-Circuit Evaulation in Euphoria in regards to converting C code to Euphoria code?
// Code B2_INLINE float b2MinFloat(float a, float b) { return a < b ? a : b; }
public function b2MinFloat(atom a,atom b) return a < b end function
2. Re: Quick Question About Short-Circuit Evaluation
- Posted by jmduro 2 months ago
- 485 views
Icy_Viking said...
Is this how you'd do Short-Circuit Evaulation in Euphoria in regards to converting C code to Euphoria code?
// Code B2_INLINE float b2MinFloat(float a, float b) { return a < b ? a : b; }
public function b2MinFloat(atom a,atom b) return a < b end function
Try this:
public function b2MinFloat(atom a,atom b) if a < b then return a else return b end if end function
Jean-Marc
3. Re: Quick Question About Short-Circuit Evaluation
- Posted by Icy_Viking 2 months ago
- 475 views
jmduro said...
Icy_Viking said...
Is this how you'd do Short-Circuit Evaulation in Euphoria in regards to converting C code to Euphoria code?
// Code B2_INLINE float b2MinFloat(float a, float b) { return a < b ? a : b; }
public function b2MinFloat(atom a,atom b) return a < b end function
Try this:
public function b2MinFloat(atom a,atom b) if a < b then return a else return b end if end function
Jean-Marc
Thanks Jean-Marc.
4. Re: Quick Question About Short-Circuit Evaluation
- Posted by DerekParnell (admin) 1 month ago
- 150 views
Icy_Viking said...
Is this how you'd do Short-Circuit Evaulation in Euphoria in regards to converting C code to Euphoria code?
// Code B2_INLINE float b2MinFloat(float a, float b) { return a < b ? a : b; }
public function b2MinFloat(atom a,atom b) return a < b end function
An alternative could be this...
include std/math.e atom result = math:min({a,b})
There is no need to write your own function as this is already in the standard library. But if you had to, try this.
include std/math.e public function b2MinFloat(atom a, atom b) return math:min({a,b}) end function