Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics An Introduction to Swift Programming Working With Constants

Dan Loyer
Dan Loyer
46 Points

Create a constant named favoriteDessert and assign to it a string containing your favorite dessert. Remember the syntax

Create a constant named favoriteDessert and assign to it a string containing your favorite dessert. Remember the syntax for a string is some text enclosed with two double quotes. Pro Tip: Dessert is spelled with two s'

below is my code? getting errrors?

// Enter your code below

var Favoritedessert = "chocolatecake" let Favoritedessert = "chocolatecake"

constants.swift
// Enter your code below

var Favoritedessert = "chocolatecake"
let Favoritedessert = "chocolatecake"

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,627 Points

Hey Dan,

You seem to have a couple of things going on here.

  • First, you have both a variable and a constant declared, but the challenge is only asking for a constant.
  • Second, you have named it FavoriteDessert with an upper-cased "F". The challenge specifically calls for a lower-case "f" because of the naming conventions in Swift.

Challenges are very picky and very strict. If you change, add, delete, etc anything that is not specified in the task instructions, it will return the Bummer! message.

Keep Coding! :)

:dizzy:

Challenge Task 1 of 1

Create a constant named favoriteDessert and assign to it a string containing your favorite dessert. Remember the syntax for a string is some text enclosed with two double quotes. Pro Tip: Dessert is spelled with two s'

let favoriteDessert = "Batata Doce"