Categories list loop – add separator every 3 categories [closed]

<?php
$args=array(
  'orderby' => 'name',
  'order' => 'ASC',
)

$count=1; // A $count variable
?>
<?php foreach (get_categories( $args ) as $cat) :
if($count%3==0) // This condition will be true for 3,6,9,12..........
{
    //Your Code --- 
}
$count++ // Increment $count variable
 ?>
<h3><a href="https://wordpress.stackexchange.com/questions/246349/<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a></h3>
<a href="https://wordpress.stackexchange.com/questions/246349/<?php echo get_category_link($cat->term_id); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
<?php endforeach; ?>

I have added comments to understand.