Six Simple Rules for Writing Pseudo Logic as a beginner.

Puneet Arora
3 min readNov 6, 2022

--

It is common practice to inquire of programmers exactly what it is they are accomplishing through their coding.

The description of a computer program that is done using straightforward “English Statements” and high-level programming language is referred to as a “Pseudo logic” construct.

The term “Pseudo Logic” does not indicate that the explanation is “false,” but rather that it is a logical sequence of instructions of the program or code.

The term does not imply that it is a “false” explanation, it is in fact the actual explanation of what the coding is doing.

When you need to improve the performance of the code or algorithm, then also it becomes necessary to write pseudo logic and dry run the program without actually running multiple experiments.

Are there some rules for writing pseudo logic?

Because writing a sequence of instructions is identical to writing “English statements” that are mathematical in character, the answer to this question is “yes,” there exist rules.

The reason for this is that creating a sequence of instructions may be thought of as a kind of writing “English sentences.”

The practice of writing pseudo logic follows a set of rules, just like the English language does with its syntax.

In this article, there are certain excellent rules that must be followed in order to construct the excellent pseudo logic that can be utilised to explain algorithms and theorems of computer science. These rules can be found in this post.

Rule I

Expressions: Expressions are the directions given to the computer by the programmer. In order to express numeric and boolean expressions, we make use of conventional mathematical symbols. When writing assignment statements, we use the left arrow () as the assignment operator, which is equivalent to the = operator in C, C++, or Java. When writing boolean expressions, we use the equal sign (=) as the equality relation, which is equivalent to the “==” relation in Java and other languages.

Object Collection or Array Indexing: A[i] represents ith cell in an array or Object collection. The cells of an n-celled array A are indexed from A[0] to A[n-1]

Rule II

Method Declaration: Method_Name(parameter1, parameter2,..), declares the method or function with arguments.

Rule III

Function or Method Calls: function_name(parameter1, parameter2,..). In case, it is an object-oriented programming paradigm then it is class_object.function_name()

Rule IV

Function Returns: use the ‘return ‘ value statement.

Rule V

Decision structure : We utilize indentation to indicate what has to be carried out in the true part and the false part of the logical actions, depending on whether the if condition then action statement contains true actions or false actions.

Rule VI

While /For Loop: While conditions do actions. For the purpose of indicating which actions or instructions ought to be included in the loops, we make use of indentation.

Always keep in mind that machines are incapable of comprehending the logic that people use. This is written in order to make the code more easily understandable, explainable, and interpretable. It is imperative that we make it our goal to communicate a high-level concept through the code in such a way that the ‘logical flow’ is easily understood by the reader and that an easy analysis can be performed. First and foremost, the reader needs to be able to obtain a sense of the complexity and storage space of the piece of code

Application of Six Rules :

Finding the maximum value element in an array.

Pseudo Logic:

Application of Six Rules to Write Pseudo Logic

I hope it helps to write , pseudo-logically !

--

--

Puneet Arora
Puneet Arora

Written by Puneet Arora

Information addict, Content Writer and Kitchen Gardener

No responses yet