Cybersecurity
DevOps Cloud
IT Operations Cloud
ChaiScript uses the "Range" object for iterating lists, Vectors, and Maps. Mainly, it does it behind the scenes while you use the for ( rec : list )
syntax. However, a Range can be a very useful way to quickly grab the first or last item in a list:
var firstField = range( rec.Fields() ).front();
var lastField = range( rec.Fields() ).back();
The above code creates a Range which wraps the list returned by rec.Fields()
. The range can be used for iterating the list if desired, but the helpful hint here is how to access the first or last item in the list.