Exclusive on for boolean switches

Hello, I’m new to Homeassistant and have been trying for several hours to create an automation that only ever has one of 4 boolean switches active. Logically, it’s always the last one activated. I can do it with 4 individual automations but somehow not in one combined one. Can someone help me?
I come from ioBroker and it felt easier with blockly…

I think this would work.

description: ""
mode: single
triggers:
  - trigger: state
    entity_id:
      - input_boolean.one
      - input_boolean.two
      - input_boolean.three
      - input_boolean.four
    to: "on"
conditions: []
actions:
  - repeat:
      for_each:
        - input_boolean.one
        - input_boolean.two
        - input_boolean.three
        - input_boolean.four
      sequence:
        - condition: template
          value_template: "{{ repeat.item != trigger.entity_id }}"
        - action: input_boolean.turn_off
          metadata: {}
          data: {}
          target:
            entity_id: "{{ repeat.item }}"

I’m going crazy, it works!
I just don’t understand the repeat.item function, what exactly does it do?
But thank you very much for the solution.

It loops the following strings (using one string at the time)

        - input_boolean.one
        - input_boolean.two
        - input_boolean.three
        - input_boolean.four

The condition then checks if the triggering entity is not the same as the string (repeat.item).
So as an example you turn on boolean three.
The first loop the repeat.item is input_boolean.one, trigger.entity_id is …three.

The condition passes and boolean one is turned off.

Second loop does the same except repeat.item is …two.

On the third loop repeat.item is the same as the triggering entity is so condition fails and the loop skips to boolean four.

Another option that does the same thing without a Repeat:

alias: Entrained Booleans (only 1 on at a time)
description: ''
trigger:
  - platform: state
    entity_id:
      - input_boolean.test_bool_1
      - input_boolean.test_bool_2
      - input_boolean.test_bool_3
      - input_boolean.test_bool_4
    to: 'on'
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: '{{ inactive_bools }}'
variables:
  inactive_bools: >-
    {{ ['input_boolean.test_bool_1', 'input_boolean.test_bool_2', 
    'input_boolean.test_bool_3', 'input_boolean.test_bool_4'] 
    | reject('eq', trigger.to_state.entity_id) | list -}}
mode: single