## Show:

This resource is designed as a syntax guide that can be used offline as a printable resource in an Edexcel Computer Science NEA.

## Syntax Guide

This website aims to give a quick reference for VB.NET, Python and pseudocode and is aimed primarily at teachers & students working towards a GCSE in Computer Science

VB.NET and Python are both programming languages designed to be understood and followed by computers. Pseudocode is not a programming language: it's written to be understood by humans so that they can turn it into any programming language.

Each exam board has published a document saying how they'll write pseudocode in their exams. The whole idea of syntax (a set of rules) for pseudocode is silly - it's not designed to be a programming language that is run by a computer. With this in mind, all exam boards state that you don't have to follow the syntax for 'their' version of pseudocode when you write out your own algorithms, but you should be able to understand their version of pseudocode when reading an algorithm in an exam.

Skill
Description
VB.NET
Python
Data types

Integers are whole numbers

Reals are numbers that can have decimal places

Booleans are either True or False

Character is a single digit

Strings are made up of characters

Constants

The value of constants can only ever be set once.

Arrays

Initialises a one-dimensional array with a set of values.

Indices start at zero (0) for all data structures.

Length of array

Count the number of values in an array

Length of string

Count the number of characters in a string

Random numbers

This generates a random number from 0 to n.

Comments

A comment can be on a line by itself or at the end of a line.

Set a value in an array

Assigns a value to an element of a one-dimensional array.

Indices start at zero (0) for all data structures.

Set a value in a 2D array

Assigns a value to an element of a two dimensional array.

Indices start at zero (0) for all data structures.

IF

If <expression> is true then command is executed.

IF ... ELSE

If <expression> is true then first <command> is executed, otherwise second <command> is executed.

WHILE loop

Pre-conditioned loop. Executes <command> whilst <condition> is true.

REPEAT UNTIL loop

Post-conditioned loop. Executes <command> until <condition> is true. The loop must execute at least once.

REPEAT ... TIMES loop

Count controlled loop. The number of times <command> is executed is determined by the expression

FOR loop

Count controlled loop. Executes a fixed number of times.

FOR loop with step

Count controlled loop using a step

FOR EACH loop

Count controlled loop. Executes for each element of an array.

Display text on screen

Sends output to the screen.

Read input from user

Reads input of specified type.

Read one line from a file

Reads in a record from a <file> and assigns to a <variable>.

Each READ statement reads a record from the file.

Read whole contents of file

Reads in the whole contents from a <file> and assigns to a <variable>.

Write to a file

Writes a record to a file.

Each WRITE statement writes a record to the file.

Define a procedure

Defines a procedure.

Define a function

Defines a function.

Call a procedure or function

Calls a procedure or a function.

Arithmetic operators

Used to change values by performing mathematical calculations.

Relational operators

Used to compare two values

Logical operators

Used to combine multiple boolean expressions:

AND: Returns true if both conditions are true.

OR: Returns true if any of the conditions are true.

NOT: Reverses the outcome of the expression; true becomes false, false becomes true.

Loading...