{#
  variables that are available:
  - {{ isLoggedIn }}
  - {{ profile }}: only available when logged in
#}

{% if isLoggedIn %}
  {{ 'msg.ProfilesLoggedInAs'|trans|format(profile.display_name, profile.url.dashboard)|raw }}
{% endif %}

{% if not isLoggedIn %}
  <a href="{{ geturlforblock('Profiles', 'Login') }}?queryString={{ geturlforblock('Profiles') }}">{{ 'lbl.Login'|trans|ucfirst }}</a>
{% endif %}

{#
  variables that are available:
  - {{ isLoggedIn }}
  - {{ profile }}: only available when logged in
#}

{% if isLoggedIn %}
  {{ 'msg.ProfilesLoggedInAs'|trans|format(profile.display_name, profile.url.dashboard)|raw }}
{% else %}
  <a href="{{ geturlforblock('Profiles', 'Login') }}?queryString={{ geturlforblock('Profiles') }}">{{ 'lbl.Login'|trans|ucfirst }}</a>
{% endif %}

Use If else statement instead of 2 if statements
Use If else statement instead of 2 if statements