Trying to use a foreach statement for a list of strings. Also substrings

I am trying to make an inventory system in my game and (I am still at the very beginning of it, literally this is all I have) my plan is to use a string of numbers to represent what item is to be there, quantity, level, and lots of other stuff.

I am honestly unsure of why this code is failing but it is giving me the CS0103 error for the line where I try and define “chanceRead” (it is inside the foreach)

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

public class EnemyScript : MonoBehaviour
public static List possibleIds = new List();

private GameObject pickupPrefab;

void Start()


void SummonPickup()
    float randomNumber = Random.Range(0, 10);

    bool targetFound = false;
    foreach (string id in possibleIds) 
        if (targetFound == false)

        string chanceRead = id.Substring(1, 3); // CS0103 error found here

        int chanceDidget = int.Parse(chanceRead); //chanceRead doesnt exist

        if (chanceDidget >= randomNumber)
            targetFound = true;
            randomNumber = randomNumber - chanceDidget;

    GameObject spawnedPrefab = Instantiate(pickupPrefab, transform.position, Quaternion.identity);



It has came to my attention that I am an idiot and cannot read. I left out the brackets to my if statement and was so laser focused on the substring stuff that I failed to notice it. Hopefully someone finds this code useful for other reasons, but this is case closed as far as my question goes.
Thank you YeymakUnity for pointing that out for me and explaining it without being to harsh to my ego. I have been humbled but I think I’ll come out of this stronger and more aware of how easily I can mess up basic things.