Flip between 0 and 0.5 every time a for loop runs

I’m trying to create a hexagonal terrain map but each row has to be offset by 0.5 for every second row to they fit but i have no idea how to do that

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FragmentGenerator : MonoBehaviour {

	public GameObject chunk;

	//values to determine fragment detail and size

	//randomness
	public int seed;

	//chunk always cubes
	public int fragmentSize;
	public float threshhold;

	//hexagon
	public GameObject hexagon;

	//creating 3d noise from lower dimensions
	public static float perlin3DValue (float x, float y, float z){
		float AB = Mathf.PerlinNoise (x, y);
		float BC = Mathf.PerlinNoise (y, z);
		float AC = Mathf.PerlinNoise (x, z);

		//inverse
		float BA = Mathf.PerlinNoise (y, x);
		float CB = Mathf.PerlinNoise (z, y);
		float CA = Mathf.PerlinNoise (z, x);

		float ABC = AB + BC + AC + BA + CB + CA;
		return ABC / 6f;
	}

	void Generate (int size, GameObject item){

		//many row
		for (float x = 0; x < size; x += 0.865f) {

			//z needs to changed to 0 or 0.5 each time above loop is run

			//create row
			for (float z = 0; z < size; z++) {

				Vector3 placepos = new Vector3 (x, 0, z);
				Instantiate (item, placepos, Quaternion.identity);

			}

		}
	}


	void Start () {
		Generate (fragmentSize, hexagon);
	}
	

	void Update () {
		
	}
}

void Generate (int size, GameObject item){
float initialZ = 0 ;
//many row
for (float x = 0; x < size; x += 0.865f) {

         //create row
         for (float z = initialZ ; z < size; z++) {

             Vector3 placepos = new Vector3 (x, 0, z);
             Instantiate (item, placepos, Quaternion.identity); 
         }

         initialZ = 0.5 - initialZ ; // values taken : 0 - 0.5 - 0 - 0.5 - 0 - ...


     }
 }