Iterators are macros that return a value or NULL to terminate the loop. A macro is handled as an iterator when called after the foreach (@@) mark.
Here's an implementation of a generic numeric for loop using an iterator
; implementation of a numeric range 'for' loop in radare script
; usage: x @@ .(for 10 100)
(for from to
?$@+$0==$1 ; if (from+iter == to)
??() ; return NULL
()$@+$0 ; return from+iter
)
So now we can write something like this:
x @@.(for 0x300 0x400)
...
To execute the 'x' command at every offset from 0x300 to 0x400.