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

C#

Zyeshawn wilson
Zyeshawn wilson
353 Points

How do you initialize book title with the title of your favorite book?

Where i place the = sign.... is it before or after title?

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The data type and variable name come on the left side of the equals sign. The value to be assigned to the variable comes on the right side, Here's an example;

int x = 20;
string text = "This is my text";

In the example above a variable named x will be assigned a value of 20. The variable named text will be assigned a value of "This is my text".

Hope this helps! :sparkles:

Zyeshawn wilson
Zyeshawn wilson
353 Points

Didnt work, am I supposed to put x=20; above it too? Why is it x=20?

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

You didn't link a challenge so I just posted some examples. I picked the values completely at random. If you could post a link to the challenge and a sample of what you've tried, I could probably help you better :smiley:

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! It's important to note when doing these challenges that you should try to follow instructions to the letter. This includes spelling, punctuation, capitalization, and even spacing. At some point, you managed to change your capital "T" to a lowercase "t" and now it can't find the correct variable. The only line that should be present in Step 2 of the challenge would be (given your example):

string bookTitle = "The One";
Zachary Walters
seal-mask
.a{fill-rule:evenodd;}techdegree
Zachary Walters
iOS Development with Swift Techdegree Student 1,330 Points

To initialize a variable is to set it equal to something. In your case, something like:

string bookTitle = "To Kill a Mockingbird";

I hope this helps!

Zyeshawn wilson
Zyeshawn wilson
353 Points

Doesnt Work I think you're supposed to have equal sign before parentheses and title place right after bookTitle

Zyeshawn wilson
Zyeshawn wilson
353 Points

C# Basics Course > Learn C# > Variables 2 Objectives > Challenge Task 2 of 2 Initialize bookTitle with the title of your favorite book.

My Ex: string booktitle = "The One";