Skip to content

Instantly share code, notes, and snippets.

@nandanhere
Forked from TheNova22/Readline
Last active October 29, 2020 04:20
Show Gist options
  • Save nandanhere/15c136f7c505e44dc2d3429c06907d92 to your computer and use it in GitHub Desktop.
Save nandanhere/15c136f7c505e44dc2d3429c06907d92 to your computer and use it in GitHub Desktop.
Readline Operations
// vim: syntax=swift
let line = Int(readLine()!)!
let line1 = readLine()!.split(separator: " ").map{ Int(String($0))! }
let numbers = readLine()!.components(separatedBy: [" "]).map { Int($0)! }
// to print a double / float with x precision
print(format:"%.xf",double_variable_here)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment