Also written as number types
Integers & Floats
PY · Numberssyntax
x = 42
y = 3.14
example
count = 1_000_000
ratio = 0.618
print(type(count), type(ratio))
print(count + ratio)
output
<class 'int'> <class 'float'>
1000000.618
Note Underscores in numeric literals are ignored and serve as visual separators. Python ints have unlimited precision.
string, number, boolean
TS · Basic Typessyntax
let varName: string = value;
let varName: number = value;
let varName: boolean = value;
example
let username: string = "alice";
let price: number = 29.99;
let isActive: boolean = true;
output
// All three are primitive types inferred automatically when initialized
Note Use lowercase string, number, boolean. The uppercase versions (String, Number, Boolean) are wrapper objects and almost never what you want.