Language Basics
Building blocks of Nevaarize
Comments
Nevaarize supports single-line comments with //:
// This is a comment
print("Hello") // Inline comment
// Multi-line comments can span
// multiple lines like this
Variables
Variables are dynamically typed and don't need explicit declarations:
// Assign values directly
name = "Nevaarize"
version = 1
pi = 3.14159
active = true
// Reassign with different types
value = 42
value = "now a string"
value = [1, 2, 3]
No-Underscore Policy
Nevaarize enforces a No-Underscore Policy for identifiers. Use camelCase instead of snake_case.
// ✗ Not allowed
my_variable = 10
// ✓ Use camelCase
myVariable = 10
Data Types
Nevaarize has the following primitive types:
| Type | Description | Example |
|---|---|---|
int |
64-bit integer | 42, -100 |
float |
64-bit floating point | 3.14, -0.5 |
string |
Text string | "hello" |
bool |
Boolean | true, false |
array |
Dynamic array | [1, 2, 3] |
nil |
Null value | nil |
Type Checking
// Check type with type() function
x = 42
print(type(x)) // "int"
y = 3.14
print(type(y)) // "float"
z = "hello"
print(type(z)) // "string"
Operators
Arithmetic Operators
a = 10
b = 3
print(a + b) // 13 (addition)
print(a - b) // 7 (subtraction)
print(a * b) // 30 (multiplication)
print(a / b) // 3 (integer division)
print(a % b) // 1 (modulo)
Comparison Operators
x = 5
y = 10
print(x == y) // false (equal)
print(x != y) // true (not equal)
print(x < y) // true (less than)
print(x <= y) // true (less or equal)
print(x > y) // false (greater than)
print(x >= y) // false (greater or equal)
Logical Operators
a = true
b = false
print(a and b) // false
print(a or b) // true
print(not a) // false
Strings
Strings are enclosed in double quotes:
// String literals
greeting = "Hello, World!"
// Concatenation with +
first = "Hello"
second = "World"
combined = first + ", " + second + "!"
print(combined) // "Hello, World!"
// String length
print(len(greeting)) // 13
// Convert to string
num = 42
text = str(num) // "42"
Type Conversion
// String to number
numStr = "42"
num = int(numStr)
print(num + 8) // 50
// Number to float
intVal = 10
floatVal = float(intVal)
print(floatVal) // 10.0
// Anything to string
str(42) // "42"
str(3.14) // "3.14"
str(true) // "true"
str([1,2,3]) // "[1, 2, 3]"
Print Function
The print function outputs values to the console:
// Single value
print("Hello")
// Multiple values (space-separated)
print("Name:", "Alice", "Age:", 25)
// Mixed types
print("Result:", 42, "is", true)