How really return works?

In a case where I find my answer in a function or in a loop, I want to return the value, but it seems like this is not the correct way.

For example here:

for(int i=0 ; i<4 ; i++)
	{
		if(nums[i]+nums[i+1] == target)
		return new int[] {nums[1], nums[i+1]};
	}
Comments (1)