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,061 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:

Ary de Oliveira
Ary de Oliveira
28,166 Points

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"