From 28374089e3f90f75a700adb1019a447fc0396cae Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Wed, 28 May 2025 17:19:12 -0700 Subject: [PATCH] Update the code block for Expressive --- _data/new-data/landing/callouts.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/_data/new-data/landing/callouts.yml b/_data/new-data/landing/callouts.yml index 8d36d78b1..286605f5b 100644 --- a/_data/new-data/landing/callouts.yml +++ b/_data/new-data/landing/callouts.yml @@ -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)) """)