Very embarrassing beginner's question...

I'm an old C programmer just starting to learn Swift and the X-code environment. In Apple's "Develop in Swift Fundamentals", on page 19 I found the first exercise to print "Hello World" in the Terminal using Swift REPL. Weirdly, after following the instructions, I get the following "Badly placed ()'s" error (I'm omitting the Swift Subcommands menu)-

Last login: Tue Dec 26 12:55:07 on ttys000 [MacBook-Pro:~] xxxxx% swift

Welcome to Swift!

[MacBook-Pro:] xxxxx% print("Hello, World!") Badly placed ()'s. [MacBook-Pro:] xxxxx%

This is a pretty discouraging result! Obviously, I'm missing something (and please, no jokes about requisite neurons).

Welcome to the forum

Why starting in terminal ?

But here is how it works: Open terminal and type swift repl you get a welcome message type print("hello world!") you get it in the console:

Last login: Tue Dec 26 20:51:28 on ttys002
x@myMac ~ % swift repl
Welcome to Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5).
Type :help for assistance.
  1> print("hello world!")
hello world!
  2

Here is a tutorial: https://developermemos.com/posts/swift-repl

But you could create a playground .

Sorry, I (maybe) found the problem. The book omitted the instruction to use the "swift repl" command before the print command. Once I did so, the print command worked properly.

Thanks Claude31. I'm just following the instructions in the book mentioned in the post. I found the problem: those instructions don't specify running "swift repl"; they just say to run swift and then run the print command. Although I'm just starting to update my programming skills, this taught me a lesson: documentation is often misleading!

Very embarrassing beginner's question...
 
 
Q