WordPress Loop if/else

https://codex.wordpress.org/Class_Reference/WP_Query#Properties

found_posts is the total number of posts returned by the query.

example code:

<?php
$args = array( 'post_type' => 'your_custom' );
$custom_query = new WP_Query( $args );

if( $custom_query->have_posts() ) {
   $number_of_posts = $custom_query->found_posts; 

   while( $custom_query->have_posts() ) { 
      $custom_query->the_post();

      if( $number_of_posts == 1 ) { 
         the_content(); 
      } else { 
         the_excerpt(); 
      }

   } 

   wp_reset_postdata();

}
?>