---
title: "for loop In c#"  
description: "for loop In c#"  
author: "Anonymous User"  
published: 2015-12-06  
updated: 2015-12-06  
canonical: https://www.mindstick.com/forum/33684/for-loop-in-c-sharp  
category: "c#"  
tags: ["c#", ".net", "loop"]  
reading_time: 1 minute  

---

# for loop In c#

I want to use for [loop in c#](https://www.mindstick.com/forum/33669/while-loop-in-c-sharp) Please help me.

## Replies

### Reply by Anonymous User

The [for loop](https://www.mindstick.com/forum/12568/android-for-loop-not-working-in-main-thread) is a bit different. It's preferred when you know how many iterations you want, either because you know the exact amount of iterations, or because you have a variable containing the amount.

```
using System;  namespace ForLoop{    class Program    {        static void Main(string[] args)        {            int number = 10;            for (int i = 0; i < number; i++)                Console.WriteLine(i);            Console.ReadLine();        }    }}
```

![for loop In c#](https://www.mindstick.com/mindstickforums/5cc7b150-cbd2-4bc2-adde-2bf968559567/images/ccd23d97-fbc8-4c6d-9aaa-faa4cc37a8a1.png)


---

Original Source: https://www.mindstick.com/forum/33684/for-loop-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
