psuedocode Flashcards
constants
CONSTANT <identifier> = <value>
eg CONSTANT pi = 3.14</value></identifier>
assignment
uses <-
eg num <- 1
input/ putpt
num <- USERINPUT
OUTPUT num
arithmetic operations
+ - / *
MOD
DIV
logical operations
AND OR NOT XOR
random num generation
RANDOM_INT (min, max)
(includes min and max)
selection
IF <condition> THEN
<statement>
ELSE
<statement>
ENDIF</statement></statement></condition>
count controlled iteration
FOR <identifier> <- <value1> TO <value2> (STEP <increment>)
<statement>
ENDFOR</statement></increment></value2></value1></identifier>
pre condition iteration
WHILE <condition> DO
<statement>
ENDWHILE</statement></condition>
post condition iteration
REPEAT
<statement>
UNTIL <condition>
</condition></statement>
procedures
PROCEDURE <identifier> (parameters)
<statement>
ENDPROCEDURE
(for function replace procedure with function and add RETURN)</statement></identifier>