Why doesn't this function call work?

a = true;
if (a) {
trace(“a is true”);

function ab () {
trace(“fun ab()”);
};

};

ab();

//
I really want to learn why ab() does not trace “fun ab()”.
Even when you call ab from a button click, it does not trace.
Simply Why ?