Comunidad de diseño web y desarrollo en internet online

Operador "mas menos"

Citar            
MensajeEscrito el 13 Oct 2008 03:03 am
Existe un operador o similar que equivalga al "mas menos" para admitir cierto error?

Por calamargo

10 de clabLevel



 

Bs As, Argentina

firefox
Citar            
MensajeEscrito el 13 Oct 2008 04:11 am
No, no existen esos operadores, lo que puedes hacer es utilizar operadores lógicos para definir un rango, por ejemplo:

Código ActionScript :

if(a >= 0 && a <= 10){  
   trace("a está entre 0 y 10");  
}else{  
   trace("a es menor a 0 o mayor a 10");
}

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 13 Oct 2008 08:37 pm
Gracias, me improvisé algo con unos OR en un IF.
Saludos.

Por calamargo

10 de clabLevel



 

Bs As, Argentina

firefox
Citar            
MensajeEscrito el 13 Oct 2008 10:15 pm

Código ActionScript :

function isAproximation (value:Number , target:Number, maxError:Number):Boolean
{
return value < (target + maxError) && value > (target - maxError);
}

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.