There is a ‘forr’ code snippet for reverse ‘for’ loop

By | August 28, 2013

Couple of days back we have discussed about one of the hidden and very useful code snippet, ‘propfull – for property and backing field’. Today you will learn another interesting code snippet ‘forr’. Yes, you read it correctly ! ‘forr’ . You must be familiar with ‘for’ code snippet  that generates basic for-loop structure.  Where as, ‘forr’ generates the reverse for-loop .

For an instance if you type   “for”  and then press TAB key twice, a default for-loop will be generated as shown in below. The default loop will have an ‘index’ – i and a max length variable defined as ‘length’

for_codesnippet

Now, in the case of ‘reverse for-loop’, you can use ‘forr’. That will generate a reverse for-loop as shown below, where you will find a similar index and length variable as general for-loop but in decreasing manner.

forr_reversefor_codesnippet

Hope you will use it going forward.