Follow us on X (Twitter)  Like us on Facebook  Connect with us on LinkedIn  Subscribe to our YouTube Channel  Subscribe to our WhatsApp Group

In every programming language, when you want to loop through a collection, you use the 'for' loop in maximum scenarios. When writing code in Visual Studio, you might be aware that, there exist a code snippet to write the for-loop structure.

 

But you might not noticed that, there exist another code snippet to generate a reverse for-loop. Let's see what it is and how it operates.

 

Do you know that, there exist a snippet to generate reverse 'for' loop?

 

Code snippets are the templates that makes it easier to generate repeating code patterns, such as loops, conditional statements or try-catch exception block. The code snippet 'for' does the same to generate a normal for-loop.

 

To generate the for-loop structure, write 'for' inside your Visual Studio code editor and press TAB key twice to generate it:

Generate for-loop using the 'for' code snippet

Did you check the book titled 'Mastering Visual Studio 2017'? It covers all the new features introduced in Visual Studio 2017. You can buy the book from Amazon at: http://amzn.to/2uFTRy8.

 

The other code snippet 'forr' is there to create a reverse for-loop structure. In your Visual Studio code editor window, type 'forr' and press TAB key twice. This will result the following code block in the editor:

Generate reverse for-loop using the 'forr' code snippet

 

I hope that the post was clear and easy to understand. For more posts on Visual Studio Tips & Tricks, stay tuned to this blog.

 

 

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.