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# C# Basics Methods Defining a Method

How can I get each letter to print on a separate line?

It compiles and returns the full word "cat" but not each letter on a separate line.

Program.cs
using System;

class Program
{
    static void Spell()
    {
        Console.Write("c");
    Console.Write("a");
    Console.Write("t");
    }

    static void Main(string[] args)
    {
        Spell();


    }
}

3 Answers

My bad it should be WriteLine with a capital L

Add a newline character: "\n" sometimes it's return and newline like "\r\n" Also, this: https://docs.microsoft.com/en-us/dotnet/api/system.environment.newline?view=netcore-3.0

Thanks Kevin!

Or you could use Console.Writeline as specified in the challenge

error CS0117: 'Console' does not contain a definition for 'Writeline' [/workdir/workspace.csproj] <-- hence Console.Write.