Xcode: cannot find 🙉 in scope

Hello, I simply tried the statement

var a = 🙉

in a new iPhone/iPad Swift Project, and I get the error from the Xcode text editor: "cannot find 🙉 in scope" I suppose there is an option somewhere in the Project parameters which enables emojis ... but where ? thank's for any clue!

Accepted Answer

When you write

var a = 🙉

🙉 is an identifier of an object. But you did not declare it.

If you want to assign an emoji (String) to a, you have to write

var a = "🙉"

But you could also declare a var:

var 🙉 = "Hello, I am an emoji"

And then

var b = 🙉

Fine! I was guessing an emoji was a sort of predefined 4 bit integer ... which obvious it isn't. But things are clear for me now. Great. Tanks a lot!

Xcode: cannot find 🙉 in scope
 
 
Q