The < and > operators

The < and > operators enforce minimum and maximum values to a scalar or array. As such, their usage is very simple:

print,findgen(5)
; 0.00000 1.00000 2.00000 3.00000 4.00000
print,findgen(5) < 3
; 0.00000 1.00000 2.00000 3.00000 3.00000
print,findgen(5) > 2
; 2.00000 2.00000 2.00000 3.00000 4.00000

These aren't the sort of thing you need every day, but they can be convenient. The most common use I have for them is to make sure you don't try to index an array with an out-of-bounds value:

index = 10
index2 = -1
arr = findgen(5)
nvals = n_elements(arr)

print,arr[index]
% Attempt to subscript ARR with INDEX is out of range.
% Execution halted at: $MAIN$

print,arr[ index < nvals-1 ]
; 4.00000
print,arr[ index2 > 0 ]
; 0.00000

Occasionally you can use this in a creative way that can actually save you some time. For instance if you had an array of integers (not floats) and wanted to know how many elements in the array were greater than one, you can use < and total:

arr = round(randomu(seed,1000000)*5) ; an array with integer values from 0-5

print, total( arr < 1, /int )
; 90103

This is slightly (a factor of 1.5) faster than using a simple w = where( arr ge 1, c )