I have a cube1, cube2, cube3 etc... variables and i want to use something like that:
for (int i = 1; i < 100; i++)
{
Location "cube + i" = new Location();
Console.WriteLine("cube + i + .GetX")
}
// GetX is a function that gives a random number
()after it. In C# we generally call code that "does stuff" a method, not a function (and in your case GetX is quite likely to be a method). Strive to use the terms other C# devs use because you may one day have a method that contains a local function and if you call the method a function when saying something like "I'm getting a null reference exception in my function" you might cause confusion in the minds of those reading your code