The statement is followed by the pseudocode itself, which describes the script's logic, using the following conventions: The pseudocode uses plain language mixed with keywords that convey specific constructs, such as an iteration FOR statement or conditional IF…ELSE statement. Each new statement and...
READ,WRITE,IF,ELSE,ENDIF,WHILE,ENDWHILE Pseudocode READname,hoursWorked,payRate gross=hoursWorked*payRate WRITEname,hoursWorked,gross IndenttoShowHierarchy Sequence: Keepstatementsinsequenceallstartinginthesamecolumn Selection: Indentstatementsthatfallinsideselectionstructure,butnotthekeywordsthatformtheselection...
For multiple conditions, use else-if statements:IF condition1 THEN statement(s) ELSE IF condition2 THEN statement(s) ELSE statement(s) END IFExample:IF grade >= 90 THEN OUTPUT "A" ELSE IF grade >= 80 THEN OUTPUT "B" ELSE IF grade >= 70 THEN OUTPUT "C" ELSE OUTPUT "F" END IF...
使用编程的短记(shorthands)工具。使用if-then-else 或循环结构比用英语表达更简洁;一些通用的语言构造也可在伪代码中使用(FIXME)。给函数指定参数是简洁、明了和准确的,不应该在伪代码中去除。 5. Consider the context. If you are writing an algorithm for quicksort, the statement "use quicksort to sort...
Print "Passed" else Print "Failed" endif I was just reffering to an example of pseudocode that I know for an IF STATEMENT, I just do not know how to do pseudocode for a FOR LOOP. Last edited on Nov 1, 2013 at 2:05am Nov
statement per line. Before you start using a system for pseudocode among your fellow developers, take the time to learn the most widely known conventions for writing it. This includes the best ways to structure pseudocode statements and common keywords, like the capitalized “IF / ELSE” format...
on algpseudocode from the algorithmicx package and uses the same syntax,but adds several new features and improvements.Notable features include customizable indent guide lines and the ability to draw boxes around parts of the code for highlighting differences.This package also has better support for ...
another Procedure a mini-algorithm, that is a part of a bigger algorithm Selection choice of action depending on a comparison or test. This uses the IF..THEN..ELSE statement Repetition Doing the same thing over and over again. There are two statements to use here - While..Do and For.....
An arithmetic operator used for integer division, returning only the quotient ELSE A part of the IF statement that executes if the condition is false ENDCASE Marks the end of a CASE OF structure ENDCLASS Marks the end of a class definition ...
ELSE ELSE IF THEN Here's a program that performs a simple IF/ELSE statement written in pseudocode. See if you can determine what this code is trying to do just by reading. START PROGRAM isOdd Create variable Choice Ask the userfora number READ INPUT into Choice IF Choice is even THEN PR...