How to Write Source Code

By Brian Gallagher

Source code is the base code of any computer program. Whenever you write a computer program, you are writing the source code. The source code you write depends upon the programming language you are working in such as Java, HTML, PHP or Python. Writing good source code can take a lot of practice. However, with time, you can become proficient in a variety of programming languages. Studying other individual's source code is also a good way to improve your programming skills.

Things You'll Need

  • A text editor (Notepad)

Step 1

Open up your text editor and begin writing code in the language of your choice. While specific syntax varies from language to language, all languages have statements. For example, in HTML you could write:

Hello World!

- This statement is denoted by the


tags.In Java, the syntax would be:System.out.println("Hello!"); The end of statement is denoted by a semicolon.

Step 2

Save the file in the proper format. In this example, save the file as "hello.html."

Step 3

Open the file in the appropriate program. You can open the example file with any web browser. You have successfully written source code.

Step 4

Right click and select "View page source" on many web pages to view the source code.

References & Resources