Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions _data/new-data/landing/callouts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@
code: |-
import ArgumentParser

@main
struct Describe: ParsableCommand {
// Complete implementation of a command line tool
@main struct Describe: ParsableCommand {
@Argument(help: "The values to describe.")
var values: [Double] = []

mutating func run() {
values.sort()
let total = values.reduce(0, +)
let smallest =
if let first = values.first {
"\(first)"
} else {
"No value"
}


print("""
Smallest: \(smallest)
Smallest: \(values.first, default: "No value")
Total: \(total)
Mean: \(total / Double(values.count))
""")
Expand Down