How can I check if WooCommerce is installed and active

When developing a custom theme or plugin, how can I check, if WooCommerce is installed and active?

You can use this snippet to check, if WooCommerce is installed and active:

if ( class_exists( 'WooCommerce' ) ) {
  // some code
} else {
  // more code
}