Time for action – Comparisons
Let's take a look at two ints and the various comparison operators we can use on them.
var int Int1, Int2; function PostBeginPlay() { 'log(Int1 == Int2); } defaultproperties { Int1=5 Int2=5 }
Setting both of them to the same value and using the equal comparison gives us
True
in the log:[0007.79] ScriptLog: True
If the variables weren't exactly the same, we would get False.
The opposite of this comparison is "Not Equal", which is denoted by an exclamation point followed by an equal sign. If we wanted to know if two variables weren't the same, we would use this.
var int Int1, Int2; function PostBeginPlay() { 'log(Int1 != Int2); } defaultproperties { Int1=3 Int2=5 }
Since they have different values, we'll get
True
in the log again:[0007.70] ScriptLog: True
Equal or not equal also apply to vectors and rotators. Each element in those structs is compared to each other, and it will return
False
if any of them are different.For greater than or...