Replit Setup for C#
Create a Replit account in order to save and share C# projects.
- Go to the Replit sign-up page
- Fill out a username, email, and password, and click the "Sign up" button
- If necessary, prove your humanity to verify the account
- Open your email, and click the "Complete Verification" link
- On your repls page, click the "+ New repl" button
- Select "C#" from the Language list
- Enter a name for the Repl, like "HelloWorld"
- Click the "Create Repl" button to create the new project!
Replit Overview
Replit is a website that allows developers to write and run code right from a web browser!
- Files Area - This is where developers select and update files
- Code Editor - This is where developers write code
- Run Button - Developers click this button to execute the code
- Run Area - This is where the developer sees the results of the code
In the new Repl, click the "run" button to see the code execute!
TIP - C# Script Structure
In the code, there is a lot of boiler-plate code that sets up the program. These parts of the code may be outside of the scope of this lesson. All that matters for simple scripts is the code between the {
and }
where the Console.WriteLine
is now. This part is called the body of the Main
method. All the rest can be ignored to start.
using System;
class MainClass {
public static void Main (string[] args) {
// IMPORTANT STUFF GOES HERE
}
}
TIP - Specific Syntax
Make sure every piece of code is exactly correct. C# is very particular, and if one letter is wrong, the whole program could crash.
Here are some basic rules that can help deal with these errors:
- Statements should end with semi-colons (
;
) - Any text to show the user should have an opening AND a closing quotation mark (
""
) - Make sure capitalization is consistent
- Make sure parentheses open AND close (
()
)