Your second example doesn't work as expected, since inside the function you are re-assigning a value true to isVisible; and note that scope of isVisible will be only inside the function, if you are declaring it inside click function.
If you just want to know the working of above examples, and not interested in declaring variable outside the function, then try this jsfiddle.
If you want to do a show/hide functionality, then try this toggle jsfiddle. Code below.
$(function(){
$("#btnShow").toggle(
function(){
$(this).val("Show");
$("#divContent").hide();
},
function(){
$(this).val("Hide");
$("#divContent").show();
}
);
});