2

I don't know how to declare a emoji character as a variable and assign some value to it and print it. When I create Emoji variable the compiler shows an error error. Can anyone help me?

1
  • 1
    Edit -> Emoji & Symbols Commented Jan 7, 2016 at 10:29

3 Answers 3

7

Choose an emoji by pressing control+command+spacebar

var 🎉 = "whatsup" print(🎉) 
Sign up to request clarification or add additional context in comments.

Comments

5

This should work

 var 😄 = "hello" println(😄) 

Comments

1

According to the Introduction to Swift from WWDC 2014, the syntax for declaring an emoji as a variable name is:

var 😺 = "cat" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.