Whats wrong with my array?

Im getting errors on the number slot of each 0-9 something is wrong with the numbers?

Assets/PlatformCopy (1).cs(29,34): error CS1519: Unexpected symbol `;’ in class, struct, or interface member declaration

Assets/PlatformCopy (1).cs(30,9): error CS0178: Invalid rank specifier: expected ,' or ]’

its a repeat of these on several lines of the array im not sure what I did wrong.
here is full code.

using UnityEngine;
using System.Collections;

public class Platform : MonoBehaviour
{
	#region Fields
	private float _targetHeight = 0f;
	
	private Vector3 _originalPosition;
	#endregion
	
	#region Inspector Properties
	[SerializeField]
	[Range(0.25f, 10f)]
	private float _raiseSpeed = 1f;
	
	[SerializeField]
	[Range(0.25f, 10f)]
	private float _dropSpeed = 0.5f;

	[SerializeField]
	private bool _randomizeSpeeds = false;
	
	[SerializeField]
	private float _waitPauseDuration = 10f;
	
	public int[] arrayOfInts;
	
	arrayOfInts = new int[10];
	arrayOfInts[0] = 100.340;
	arrayOfInts[1] = 200.340;
	arrayOfInts[2] = 300.340;
	arrayOfInts[3] = 400.340;
	arrayOfInts[4] = 500.340;
	arrayOfInts[5] = 600.340;
	arrayOfInts[6] = 700.340;
	arrayOfInts[7] = 800.340;
	arrayOfInts[8] = 900.340;
	arrayOfInts[9] = 1000.340;
	#endregion
	
	#region Initialization
	private void Start ()
	{
		if (transform != null) {
			_originalPosition = transform.localPosition;
			StartCoroutine(PlatformMotionLoop());
		}
	}
	#endregion
	
	#region Motion Handling
	private IEnumerator PlatformMotionLoop()
	{
		float targetHeightForThisFrame = 0f;
		Vector3 newLocalPos = Vector3.zero;
		float raiseSpeed = _raiseSpeed;
		float dropSpeed = _dropSpeed;
		
		if (transform != null)
		{
			while (true)
			{
				_targetHeight = Random.Range(0, arrayOfInts.Length);
				
				if (_randomizeSpeeds)
				{
					dropSpeed = _dropSpeed + Random.Range(0f, 3f);
					raiseSpeed = _raiseSpeed + Random.Range(0f, 3f);
				}
				
				while (transform.localPosition.y != arrayOfInts[_targetHeight]) // The loop that moves the platform towards the new target height.
				{
					if (transform.localPosition.y > arrayOfInts[_targetHeight])
					{
						targetHeightForThisFrame = transform.localPosition.y + Time.deltaTime * raiseSpeed;
					}
					else if (transform.localPosition.y < arrayOfInts[_targetHeight])
					{
						targetHeightForThisFrame = transform.localPosition.y - Time.deltaTime * raiseSpeed;
					}
					newLocalPos = new Vector3(_originalPosition.x, targetHeightForThisFrame, _originalPosition.z);
					
					transform.localPosition = newLocalPos;

					
					yield return null;
				}
				
				yield return new WaitForSeconds(_waitPauseDuration); // pause before returning the platform to its original position, after the platform has lowered itself.
			
				
			}
		}
	}
	#endregion
}

You can’t initialize an array like this outside of a method/constructor:

// snip
arrayOfInts = new int[10];
arrayOfInts[0] = 100.340;
arrayOfInts[1] = 200.340;
arrayOfInts[2] = 300.340;
arrayOfInts[3] = 400.340;
arrayOfInts[4] = 500.340;
arrayOfInts[5] = 600.340;
arrayOfInts[6] = 700.340;
arrayOfInts[7] = 800.340;
arrayOfInts[8] = 900.340;
arrayOfInts[9] = 1000.340;
// end snip

But you can do it during the declaration of the array field.

public int[] arrayOfInts = new int[10] { 100.340, 200.340, 300.340, 400.340, 500.340, 600.340, 700.340, 800.340, 900.340, 1000.340 };

This leaves the question of why you’re using numbers with decimals as ints?

You can’t access or modify an array outside of a method. There are two ways to solve this

  • Put lines 29 to 39 inside of Awake

  • Initialise the data when you declare the array, as follows

    int numbers = new int[5] {1, 2, 3, 4, 5};

Note that you will also get an error by trying to put a decimal place into an int.