Re: Quick Question About Short-Circuit Evaluation

new topic     » goto parent     » topic index » view thread      » older message » newer message
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 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu