Exit not working properly

I am trying to do it where after you collect an item then going to a spot brings you to level 2. It doesn’t with this:

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

public class ExitToLevel2 : MonoBehaviour {

int itemcollected;

void OnTriggerEnter2D(Collider2D col)
if (ItemCollected.itemcollected >= 1 && col.CompareTag (“Player”))
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);



And it only works when I remove this from the if statement: ItemCollected.itemcollected >=1

You should paste your code using the code sample option(ctrl+k) so its more readable.