Range intersect and union operation

Refer to the following example code to see how to intersect and union ranges.