Checking whether if user “logged in” wordpress

<?php

if(is_user_logged_in()){

//code here

}

else{

//code here

}?>