Skip to content

Commit bd78fe1

Browse files
authored
Update the code block for Expressive (#993)
1 parent 5e4720e commit bd78fe1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

_data/new-data/landing/callouts.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,17 @@
1919
code: |-
2020
import ArgumentParser
2121
22-
@main
23-
struct Describe: ParsableCommand {
22+
// Complete implementation of a command line tool
23+
@main struct Describe: ParsableCommand {
2424
@Argument(help: "The values to describe.")
2525
var values: [Double] = []
2626
2727
mutating func run() {
2828
values.sort()
2929
let total = values.reduce(0, +)
30-
let smallest =
31-
if let first = values.first {
32-
"\(first)"
33-
} else {
34-
"No value"
35-
}
36-
30+
3731
print("""
38-
Smallest: \(smallest)
32+
Smallest: \(values.first, default: "No value")
3933
Total: \(total)
4034
Mean: \(total / Double(values.count))
4135
""")

0 commit comments

Comments
 (0)