Pseudocode and Writing Algorithms
No description yet. This curated deck is ready for daily study.
Card preview (15)
Comments
//
Variables
variablename = 3 (int) variablename = “string” (string) CONST variablename = 3 (constant)
Casting
str(20) (casts an integer to a string) int(“20”) (casts a string to an integer)
Input
variablename = input()
Output
print(“Hello”) print(5) print(variablename)
Selection
if… then elseif… then else endif
While Loop
while… endwhile
For Loop
for… endfor
Logical Operators
AND OR NOT
Comparison Operators
== != < <= > >=
Arithmetic Operators
* / MOD DIV
String Handling (length, upper, lower)
variable.LENGTH (length of a variable) variable.UPPER (converts to uppercase) variable.LOWER (convers to lowercase)
Sub-routines - creates a function and pass parameters
function name(parameters) return value endfunction
Arrays - use of an array and index
arrayname[lengthofarray] arrayname[1] = “Bob”
File Handling
OpenWrite(“filename.txt”) file.ReadLine() file.WriteLine(variable) file.Close()