Why I get this error? error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration

Whenever I use a for loop. I can’t use for loops, it doesn’t recognize it! please help!

this is my code:

using UnityEngine;
using System.Collections;

public class DNA 
{
	
	char newChar()
	{
		float c = Mathf.Floor (Random.Range (63, 122));

		if (c == 63)
			c = 32;
		if (c == 64)
			c = 46;
		return (char)c;
	}
	int num;

	public DNA (int numA)
	{
		num = numA;
	}

	public System.Array genes;
	public float fitness = 0;

	for (int i = 0; i < num; i++) {
			
	}
	
}

The for-loop must be inside a class method. -doublemax

try:

		void MyFunction () {
			for (int i = 0; i < 10; i++) {
				//stuff here
			}
		}