C# C# Basics Methods Defining a Method

kal alben-mccave
kal alben-mccave
4,553 Points

C# Code Challenge

Goodnight night everyone,

Any help rendered would be appreciated. Could you tell me what is wrong with my code? Thanks

Program.cs
using System;

class Program
{

    static void Spell();
    {
        Console.WriteLine("c");
        Console.WriteLine("a");
        Console.WriteLine("t");
    }    

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

2 Answers

Libby Exley
Libby Exley
9,462 Points

Your code is correct apart from the semicolon on the end when defining the spell method. A method has curly braces following the line so does not need the semic colon on the end. (Look at the end of the Main method) e.g.

static void Spell()
{
    Console.WriteLine("c");
    Console.WriteLine("a");
    Console.WriteLine("t");
}
kal alben-mccave
kal alben-mccave
4,553 Points

Thank you very much libby was very helpful