How to list child categories?

After some trial and error I managed to come up with the following:

<?php if (is_category( )) {

  $cat = get_query_var('cat');
  $thiscat = get_category ($cat);
  $parent = $thiscat->parent;

  if ($parent != '') {

wp_list_categories( array(
        'child_of' => $parent,
        'exclude' => $cat
    ) );
    }

  else {

wp_list_categories( array(
        'child_of' => $cat
    ) );
    }

} ?>

I’m not sure if this is the most efficient method but it does work.