Add a Max int value?

How do I make a variable ‘max out’ at a certain point?
Another way to word this is, 'how do I make a level cap?

I think I’m supposed to place an If(Count == 50) statement, but The compiler says I can’t because ‘Count’ is an int.

Thank you in advance!

Code:

    void Update()
    {
        ItemInfo.text = itemName + "

Cost: " + cost + "
Power: +" + clickpower;

        _Slider.value = Click.Click / cost;

        if (_Slider.value >= 1.0f)
        {
            GetComponent<Image>().color = Affordable;
        }
        else
        {
            GetComponent<Image>().color = standard;
        }
    }

The easiest way to limit an integer is with Mathf.Clamp()

 myInt = Mathf.Clamp(myInt, 0, 50);

You can use it inside a property:

 private int someInt;
 public int SomeInt {
      get {return someInt;}
      set {someInt = Mathf.Clamp(value, 0, 50);}
 }

 void Start () {
      SomeInt = 4321;
      Debug.Log(SomeInt);	// outputs "50"
 }

There is one more way to do this aswell. it requires some extra lines though but it makes it easier if you want something specific to happen at the set values aswell.

   if(value >= 50)
    {
    value = 50;
    }
    if(value <=0)
    {
    value = 0;
    }