How to Use Constants in Pseudocode

By Vivek Saxena

Instead of jumping directly into coding complex programming statements, you may want to consider delving in to some pseudocode. It is essentially a non-specific and informal algorithm coding guide that can be applied to any programming language. What makes it so useful is that the syntax involved in using variables, constants and modifiers is relatively simple to learn. As such, it allows you to focus on building the program's logic, after which constructing the actual code will be much simpler.

Step 01

Start by typing the term "CONSTANT" to identify that you are about to initialize a variable with a constant.

Step 11

Follow the initial term with a constant-identifier, which is essentially the variable you intend to use to store the constant.

Step 21

Continue the initialization by typing the term "AS" to indicate that you are about to identify the constant type.

Step 31

Specify a constant type. The typical types you are likely to encounter in the major programming languages include BOOLEAN, STRING, FLOATING POINT and INTEGER. Feel free to specify a currently unknown type by using the term "OTHER-DATA-TYPE."

Step 41

Identify the constant by typing "=" and then the constant. Given that you want to place the constant 54 into the variable constant_variable, the final statement would look like this:

CONSTANT constant_variable AS INTEGER = 54