Question by 
               PixelAssassin · Aug 28, 2016 at 12:20 AM · 
                c#intdeclarationy  
              
 
              Why can't "int y = 0" be a statement?
I am very new to coding, and I just came across this problem while trying to create a procedural generated world. My statement "int y = 0" gives me an error "embedded statement cannot be a declaration or labeled statement". Please help...
using UnityEngine; using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
 public int width = 128;
 public int depth = 128;
 public int height = 0;
 public GameObject grassblock;
 // Use this for initialization
 void Start ()
 {
     for (int z = 0; z <= depth; z++)
     {
         for (int x = 0; x <= width; x++)
         {
             int y = 0; (ERROR)
             Vector3 blockpos = new Vector3(x, y, z);
             Instantiate(grassblock, blockpos, Quaternion.identity);
         }
     }
 }
 
 // Update is called once per frame
 void Update () {
 
 }
}
               Comment
              
 
               
              Looking up "C# embedded statement" explains it. Your real code is probably missing some symbols.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                