Variables and constants in Sol are declared using the store
keyword followed by the variable name and optional type annotation.
Example:
store name = "John"
store mul age = 30
Assignment in Sol is performed using the =
operator.
Example:
name = "Alice"
age = 25
Sol supports conditional execution using if-else statements.
Example:
if (condition) then
// code to execute if condition is true
else
// code to execute if condition is false
end
Sol provides for
and while
loops for iterative execution.
Example:
for (i = 0; i < 10; i++) do
// code to execute in each iteration
end
Functions in Sol are defined using the fn
keyword followed by the function name and parameter list enclosed in parentheses ()
.
Example:
fn add(x, y) do
return x + y
end
Functions are invoked using the function name followed by the argument list.
Example:
result = add(10, 20)
Sol provides a standard library with built-in functions and modules for common tasks.
The IO module provides functions for input and output operations.
Example:
import "io"
io.print("Hello, World!")
The Math module provides functions for mathematical operations.
Example:
import "math"
result = math.pow(2, 3)
This reference document provides an overview of the core features and functionalities of the Sol language. For more detailed information, refer to the documentation and examples provided.