Skip to content

Conversation

@tomek7667
Copy link

@tomek7667 tomek7667 commented Dec 2, 2025

The guided tour example doesn't specify print after the greeting, so the experiment that follows won't be valid:

Change optionalName to nil. What greeting do you get? Add an else clause that sets a different greeting if optionalName is nil.

@amartini51 amartini51 changed the title chore: add missing print statement in control flow example Add print statement in control flow example Dec 8, 2025
@amartini51
Copy link
Member

Thanks for pointing this out! The examples throughout the tour use "bare" expressions in several places, expecting that the reader is running the code in a REPL or playground, so the results of function calls are visible even without printing. Older versions of the book included a link to download the chapter as a playground, which was lost when moving to DocC (see #33). However, looking again today, DocC now supports a @CallToAction directive, which should let us restore that download-playground functionality.

With that in mind, I think we're better off fixing the reader in general, instead of spot-fixing one specific example. Or, if it turns out we can't use @CallToAction, the tour should be revised to include explicit print() everywhere the code produces a result that otherwise wouldn't be visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants