You can also use loop with curly brackets like this:
if ( have_posts() ) { while ( have_posts() ) { the_post(); var_dump( $post ); } }