Data Types
Common Pseudocode supports several fundamental data types that you’ll use throughout your programs.
Numbers
Section titled “Numbers”Numbers can be integers or decimals (floating-point):
number age = 25number price = 19.99number count = 0The number type declaration is optional in most cases:
age = 25price = 19.99Strings
Section titled “Strings”Strings represent text and can be enclosed in single quotes, double quotes, or backticks:
string name = "John"string greeting = 'Hello'string message = `Welcome!`Multi-Line Strings
Section titled “Multi-Line Strings”Use backticks or triple quotes for strings spanning multiple lines:
description = `This is a multiline stringthat spans multiple lines`Or with triple quotes:
text = """This is also a multiline stringwith multiple lines"""String Interpolation
Section titled “String Interpolation”Embed variables in strings using curly braces:
name = "Alice"age = 30output "Hello, my name is {name} and I am {age} years old"// Output: Hello, my name is Alice and I am 30 years oldString Concatenation
Section titled “String Concatenation”Join strings together:
greeting = "Hello" " " "World" // Results in "Hello World"fullName = firstName " " lastNameBooleans
Section titled “Booleans”Booleans represent true or false values:
boolean isActive = trueboolean isComplete = falseBoolean literals are case-insensitive for the whole word:
- Valid:
true,True,TRUE,false,False,FALSE - Invalid:
tRuE,fAlSe(mixed case not supported)
isValid = trueisReady = TRUEisDone = FalseType Conversion
Section titled “Type Conversion”Convert values between different types:
// String to numberstringValue = "123"numValue = convert stringValue to number // or number(stringValue)
// Number to stringage = 25stringFromNum = convert age to string // or string(age)Type Checking
Section titled “Type Checking”Check if a value is of a specific type:
value = 42if is number(value) output "It's a number!"
if is string(value) output "It's a string!"
if is boolean(value) output "It's a boolean!"Explicit Type Declarations
Section titled “Explicit Type Declarations”While optional, you can explicitly declare variable types:
number age = 25string name = "John"number price = 19.99boolean isActive = truearray numbers = [1, 2, 3]This can make your code more readable and help prevent type-related errors.