Run Swift online — Swift 5 and 6, browser-hosted, no Xcode.
Swift is Apple's modern language for iOS, macOS, and (increasingly) server-side. Strong types, value semantics, protocols with associated types, and — since Swift 6 — data-race safety by default.
ls-judge runs the Linux Swift toolchain (no Xcode needed) inside a Firecracker microVM.
Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.
import Foundation
let line = readLine()!
let n = Int(line.trimmingCharacters(in: .whitespaces))!
print(n * 2)
21
42