1. Quick Question About Short-Circuit Evaluation

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 
new topic     » topic index » view message » categorize

2. Re: Quick Question About Short-Circuit Evaluation

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Quick Question About Short-Circuit Evaluation

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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu