psuedocode Flashcards
comments
//
data types
integer
real
char
string
boolean
date
declaring variable
DECLARE <variable> : <datatype></datatype></variable>
constants
CONSTANT <identifier> = <value></value></identifier>
assignment
<identifier> <— <value>
</value></identifier>
declaring arrays
1D
DECLARE <identifier> : ARRAY [lower:upper] OF <datatype>
2D
DECLARE <identifier> : ARRAY [lower1:upper1, lower2:upper2] OF <datatype></datatype></identifier></datatype></identifier>
user defined data types
TYPE <identifier> = (value1, 2, 3…)
eg TYPE season = (spring, summer, autumn…)</identifier>
non composite data type - pointer
TYPE IntPointer = ^INTEGER
composite data type
TYPE <identifier>
DECLARE <identifier> : <datatype>
DECLARE <identifier> : <datatype>
END TYPE</datatype></identifier></datatype></identifier></identifier>
input/ output
INPUT <identifier>
OUTPUT <value></value></identifier>
arithmetic operations
+ - * / // %
relational operations
<
<=
=
<>
logic operators
AND OR NOT NOR XOR NAND
if
IF <condition> THEN
<statement>
ELSE
<statement>
END IF</statement></statement></condition>
CASE
CASE OF <identifier>
1 : <statement>
2 : <statement>
…
OTHERWISE <statement>
END CASE</statement></statement></statement></identifier>