Operadores Lógicos
Aquí te dejamos el código utilizado en esta lección:
//1) SUMA (+)
RuleContext suma {
Rule rule {
Integer a = 5
Double b = 5.5
Integer c = a + b
Double d = a + b
}
}
//2) CONCATENACION (+)
RuleContext concatenacion {
Rule rule {
String a = "hola"
Integer b = 4
Double c = 5.5
Bool d = true
Date date = Date()
String e = a + b
e = a + c
e = a + date
e = a + d
}
}
//3) RESTA (-)
RuleContext resta {
Rule rule {
Integer a = 5
Double b = 5.5
Integer c = a - b
Double d = a - b
}
}
//4) SIGNO NEGATIVO (-)
RuleContext negativo {
Rule rule {
Integer a = 1
Double b = -2.4
Integer c = -a
Double d = -b
Double e = -a
Integer f = -b
}
}
//5) MULTIPLICACION (*)
RuleContext multiplicacion {
Rule rule {
Integer a = 5
Double b = 5.5
Integer c = a * b
Double d = a * b
}
}
//6) ASIGNACION (=)
RuleContext asignacion {
Rule rule {
Location loc = Location()
Location loc1 = loc
Integer a = 5
Double b = a
}
}
//7) IGUALDAD (==)
RuleContext igualdad {
Rule rule {
Integer a = 5
Double b = 5.5
Bool c = a == b //false
Location loc = Location()
Location loc1 = Location()
Bool d = loc == loc1 //false
Location loc2 = loc1
Bool e = loc1 == loc2 //true
}
}