Row count - also works for arrays but ACF repeaters etc
<?php
if( have_rows('social_flex', 'options') ) {
$rowCount = count( the_field('social_flex', 'options') );
$i = 1;
while ( have_rows('social_flex', 'options') ) { the_row();
if($i < $rowCount) {
echo ",";
}
}
}
?>