What's the target of this code? Xilinx and Altera (I think) have C compilers these days that are decent for their FPGA's
If you have a small amount of code to write and are coming from a software background the C compilers may be good.
Otherwise, as pointed out you should be able to envision the code you're writing as hardware. Loops get 'unrolled' by the synthesizer and need to be written in a way where that's possible.
If you want something that actually runs like a loop you need to construct and describe that manually. Make a counting register, increment it on a clock, choose when to stop and reset it etc.