Boolean doesn't change at start position.

I have pressed a key and toggled this function:

bool IsGrounded()
        if(Physics.Raycast(transform.position, Vector3.down * 0.75f))
            return true;
            return false;

I use this function to check if I am grounded. It works when I go off platform, but when I am above platform over the 0.75f ray lenght limit it still returns as if I am still grounded. What am I doing wrong?
Thank you.

because your raycast lenght is infinite, try this line (the vector is only the direction)

if(Physics.Raycast(transform.position, Vector3.down, 0.75f))