Should I make variables instead of functions?

I recently discovered the power of getters/setters and I found out that instead of making functions that return something you can rather make variables that return something.

Are there any pros and cons for using either?
I just can’t decide on which to choose and I want to know more about it before I get a habit of doing something I’ll have to change in the future.

I know that variables can’t pass parameters so I’ll obviously just use a function in that scenario.

I wanna hear your thoughts.

A function does something. A variable is something. They’re not interchangeable and you’re going to need both in your code…

I believe the proper term for this is Properties, in C# lingo. A Property is accessed like a method (function) but it acts like a field (variable). Properties usually have getters and setters, as you mentioned.

Properties can be really useful because it allows an object to manage its own data. Here’s a simple example from MSDN:

public class Date
{
    private int month = 7;  // Backing store

    public int Month
    {
        get
        {
            return month;
        }
        set
        {
            if ((value > 0) && (value < 13))
            {
                month = value;
            }
        }
    }
}

This allows the object to make sure that it doesn’t accept invalid data. Months only make sense if they’re between 1 (January) and 12 (December), and this class will not allow its month to be set to any values that don’t conform to that restriction.

Basically, this will help you from introducing bugs by setting values that don’t make any sense.