Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Combined fragment

A frame around messages with the operator in a pentagon at its top left. Each operand has a [guard] above its first event, and dashed lines divide operands.

diagram sequence "Alternatives"

participant Client
participant Server

alt "ok" {
  Client -> Server : get
} else "retry" {
  loop "(1,3)" {
    Client ->> Server : retry
  }
}
Alternatives loop(1,3) alt [ok] [retry] Client Server get retry

Operators: alt with else, opt, loop, break, critical, neg, and par with and. loop "(1,3)" becomes loop(1,3), which is the spec’s textual form.

Syntax

alt ["guard"] { ... } [else ["guard"] { ... }]...
par ["guard"] { ... } [and ["guard"] { ... }]...
opt|loop|break|critical|neg ["guard"] { ... }

Specification

UML 2.5.1. Operands, constraints and frames: 17.6.4.1, 17.6.4.2, 17.6.4.3 (p. 585). Loop: 17.6.4.9 (p. 586). Coregions are an optional shorthand; par covers them.

Used in

Raft log replication, RPC with retry and exponential backoff, TLS 1.3 handshake.

See also

Sequence diagrams (how to write the whole diagram), Elements of sequence diagrams, Grammar.