Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,860 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"