How to Write a Pseudocode Code Script

Written by sara williams
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Write a Pseudocode Code Script
(Stockbyte/Stockbyte/Getty Images)

Pseudocode is the plain English equivalent of computer programming. In the planning stage of a script or program, before the actual code is written, programmers will mock up the necessary code in pseudocode. The purpose of mocking up code in pseudocode, according to Dr. John Dalbey of California Polytechnic State University, is that "it allows the designer to focus on the logic" yet not get "distracted by details of language syntax." Even relatively short scripts used for Web programming benefit from good planning and some well-written pseudocode.

Skill level:
Moderately Challenging

Other People Are Reading


  1. 1

    Write a rough flowchart of your script's tasks. For example, you would like to build a quiz for your website that allows visitors to test their knowledge of movies. Think of how your script needs to function to carry out its task. In the case of a quiz, it must ask questions that are then graded and tallied. Since the quiz exists on a website, it will use a Web form written in HTML. So your script does not need to ask the questions. That leaves your script with grading and tallying.

  2. 2

    Add to your flowchart an action that triggers the script. In an online quiz, since the script will only grade and tally answers to questions, clicking the "Submit" button should trigger the script. Write this trigger above your rough flowchart.

  3. 3

    Add to your flowchart any information each step needs to perform its task, starting at the logical beginning. For example, the first step the quiz performs is grading. To grade, the program needs to get the answers from the Web form. Write this information down on your rough flowchart, next to the step.

  4. 4

    Note on the flowchart what your program needs to do with the information at each step. At the quiz's grading step, it needs to read each question's answer and then compare it with the correct answer. If an answer is correct, it is given a point. No points are given for incorrect answers. At the tallying step, the script simply adds up the points associated with each answer.

  5. 5

    Add some notes on your flowchart marking where the script needs control structures. Control structures include loops and conditional statements. In your quiz, you should see that the grading step needs to repeat itself for every question on the quiz, so note that the step requires a for-loop. The script will likely need conditional statements as well.

  6. 6

    Write your pseudocode based on the rough flowchart you created. Start at the top and write your action, such as "User submits quiz." Start the next line at an indent and write the first step. Use indents and white space to make the code readable, and set your variables, just as you would in a real script. Also write a line of pseudocode to show any output the script must generate.

  7. 7

    Check your pseudocode by reading it aloud to yourself and following the steps in your head, pretending to be the computer. If any information, processing, input or output is missing, add these where they are needed.

Tips and warnings

  • Draw your finished product, as you imagine it, on a piece of paper to help you visualise exactly how the script will work.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.