Expected ',' separator error


#1

Here is my code that I am following along with in the workbook:

import Cocoa

var str = “Hello, playground”

print(“The maximum Int value is (Int.max).”)
print(“The minimum Int value is (Int.min).”)
print(“The maximum value for a 32-bit integer is (Int32.max).”)
print(“The minimum value for a 32-bit integer is (Int32.min).”)

print(“The maximum UInt value is (UInt.max).”)
print(“The minimum UInt value is (UInt.min).”)
print(“The maximum value for a 32-bit unsigned integer is (UInt32.max).”)
print(“The minimum value for a 32-bit unsigned integer is (UInt32.min).”)

let numberOfPages: Int = 10 // Declares the type explicitly
let numberOfChapters = 3 // Also of type Int, but inferred by the compiler

let numberOfPeople: UInt = 40
let volumeAdjustment: Int32 = -1000

I can’t seem to find my mistake. I believe its exactly the same as the workbook. I cannot get anything to show up in the sidebar area nor in the debug area… Any suggestions?


#2

Are you really using those fancy quotation characters?

Replace them with the plain ones:

print ("The maximum Int value is \(Int.max).")
...

#3

Also, you’re missing the backslashes in front of (Int.max), etc:

import Cocoa

var str = “Hello, playground”

print(“The maximum Int value is \(Int.max).”)
print(“The minimum Int value is \(Int.min).”)
print(“The maximum value for a 32-bit integer is \(Int32.max).”)
print(“The minimum value for a 32-bit integer is \(Int32.min).”)

etc


#4

I am experiencing the same type of issues and I am working in Xcode 9. My problem started in Chapter 3 and it is continuing in Chapter 4. I put in the exact code as what is in the book and it quits outputting the results in the Results screen to the right and the Debug / Console screen to the bottom. Here’s the big kicker though! If I save the file, close out Xcode completely, re-open Xcode and the file then go to my print method line and press enter, it then runs just fine!

It seems like if I wait too long before entering the next line or if it thinks I’ve somehow entered something in error, the Results area and Console area quit working. I think it has to be something in the Xcode 9 preferences or settings that is causing all of the problems. I would greatly appreciate if the administrators would help because it is REALLY annoying to be new to SWIFT and try running the code that you have the code entered correctly and the code in the book appears to be correct, but it just won’t work / run because of some Xcode preferences that nobody has told me I need to make sure are set right so that it works right.


#5

Looks like you are working in playgrounds. Do you get the same if you work in a project?