{
and end with a
}
. This is why those
lines in the program don’t end with a semicolon. Blocks provide a mechanism for grouping
statements and are discussed later in this chapter.
The first
}
in the program ends
Main( )
, and the last
}
ends the
Example
class definition.
One last point: C# is case-sensitive. Forgetting this can cause serious problems. For
example, if you accidentally type
main
instead of
Main
, or
writeline
instead of
WriteLine
,
the preceding program will be incorrect. Furthermore, although the C# compiler
will
compile
classes that do not contain a
Main( )
method, it has no way to execute them. So, had you
mistyped
Main
, you would see an error message that states that
Example.exe
does not have
an entry point defined.
www.freepdf-books.com
22
P a r t I :
T h e C # L a n g u a g e
Do'stlaringiz bilan baham: |