How can I write a multi-line if block on Bitbucket Pipeline?

I found that this works:

- if [ $BITBUCKET_BRANCH == 'master' ]; then
- echo "We are on master"
- fi

Bitbucket pipelines are written in YAML, so you can take full advantage of the YAML language.

For multiline, you can also use either | or > operators.

- >
  if [ $BITBUCKET_BRANCH == 'master' ]; then
    echo "We are on master :)"
  else
    echo "We are not on master :("
  fi

More information: https://yaml-multiline.info/

NB: I guess this use-case was just an example, but you can also filter pipelines steps by branches directly: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-SectionDescription