Skip to content

Commit 84cb927

Browse files
authored
Fix syntax in concurrency example (#45)
2 parents d686281 + a4a60b4 commit 84cb927

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/TSPL/TSPL.docc/LanguageGuide/Concurrency.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ Code in between possible suspension points runs sequentially,
255255
without the possibility of interruption from other concurrent code.
256256
For example, the code below moves a picture from one gallery to another.
257257

258-
```
258+
```swift
259259
let firstPhoto = await listPhotos(inGallery: "Summer Vacation")[0]
260-
add(firstPhoto toGallery: "Road Trip")
260+
add(firstPhoto, toGallery: "Road Trip")
261261
// At this point, firstPhoto is temporarily in both galleries.
262-
remove(firstPhoto fromGallery: "Summer Vacation")
262+
remove(firstPhoto, fromGallery: "Summer Vacation")
263263
```
264264

265265

@@ -271,10 +271,10 @@ To make it even clearer that this chunk of code
271271
must not have `await` added to it in the future,
272272
you can refactor that code into a synchronous function:
273273

274-
```
274+
```swift
275275
func move(_ photoName: String, from source: String, to destination: String) {
276-
add(photoName, to: destination)
277-
remove(photoName, from: source)
276+
add(photoName, toGallery: destination)
277+
remove(photoName, fromGallery: source)
278278
}
279279
// ...
280280
let firstPhoto = await listPhotos(inGallery: "Summer Vacation")[0]

0 commit comments

Comments
 (0)