Double Division in Swift

Level 116 keystrokes

Divides two Double values so the result keeps its fractional part: 7.0 / 2.0 prints 3.5.

Swift code

// Double / Double keeps decimals: 3.5 (7 / 2 with Int would give 3)
1print(7.0 / 2.0)

Output

3.5
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Swift code and how often they appear.

  • .× 2
  • (× 1
  • )× 1
  • /× 1

More Swift examples at level 1

← Swift typing practice