Skip to content

Files

Latest commit

 

History

History
23 lines (16 loc) · 544 Bytes

tuple_pattern.md

File metadata and controls

23 lines (16 loc) · 544 Bytes

Pattern: Assigning variable through tuple pattern

Issue: _

Description

Assigning variables through a tuple pattern (sometimes referred to as a tuple shuffle) is only permitted if the left_hand side of the assignment is unlabeled.

Labels on the left_hand side closely resemble type annotations, and can lead to confusing code.

Examples of correct code:

// ok
let (a, b) = (y: 4, x: 5.0)

// triggers

Examples of incorrect code:

let (x: a, y: b) = (y: 4, x: 5.0)
let (x: Int, y: Double) = (y: 4, x: 5.0)