Beginner's question, new to programming

So from java I'm aware that void doesn't return a variable.

So I have something like this
In the beginning, i defined a variable. Let's say..

int hello = 0
//and other variables

void setup()
{
//stuff here
}

void loop()
{
// stuff here
hello = 2^anothervariable
return hello;
//stuff
//
}

Now I tried changing the "void loop" into "int loop" as I usually would do in java, except the code still wouldn't compile. Can someone help me? I'm new to this language and don't really know many commands

You can't change the setup() or loop() calls to anything besides void. There is simply nowhere for the return to go.

What you need to do is get a starter kit like http://www.sparkfun.com/products/10173 and just go nuts with it. Try! Do! Experiment! Write goofy code and watch it fail miserably! It's all about the journey.

Arduino is hiding a lot of backend C++ code from you, the function prototype defines the return type of a function and the prototype for setup and loop are hidden.

I wrote a complicated program that uses the variable "hello" later on in the code for an LED matrix

Is there something within the void or loop I can say? Or do I need to rewrite everything =(

I have no idea how to help because I have no idea what you are trying to do.

You DO know that variables declared outside of functions are usable by other functions, right?

Like:
int hello = 0
//and other variables

void setup()
{
}

void loop()
{
}

If you set "hello" to a value in any function... setup and loop included... it will be usable anywhere else in the code.

So I'm working with an LED dot matrix.

So a dot flashes back and forth through the columns. When a button is pressed, the dot pauses
So this part is just stacking the dots.

So, the code has to check that the dots are being stacked in the same column each time. So I assigned a number to each row in the column

And basically I was setting like

while(switchstate == 0) //for the button
{
//code, int col is being changed here
colstuff = 2^col;
//delay
flash = 2^col;
return flash;
}
That way, when the button is pressed and the while statement is broken, it would be pressed in between colstuff and flash, and the values wouldn't be same all the time.

Then later I can compare the two values later.

err... you are not making much sense, your code doesn't make sense because the return statement in the while loop will always execute, so the while loop is essentially an if statement.

the boolean expression given as the condition of a while loop is only evaluated at the start of the loop