Overview of Soplang
Soplang is an open-source programming language released under the MIT License. It is designed for simplicity, readability, and power, specifically allowing developers to write code in the Somali language.
website·Indexed 31 days ago
https://soplang.orgA programming language designed to be intuitive and powerful with a Somali-first approach. Documentation covers installation, syntax, data types, variables, operators, conditional statements, loops, functions, and built-in keywords.
soplang binary is in your system's PATH. For UNIX-like systems, you may need to grant execute permissions to the binary using chmod +x.# Add binary directory to PATH (example for shell/zsh)
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.shellrc && source ~/.shellrc
# Grant execute permissions if needed
chmod +x /path/to/soplang
# Verify installation
soplang --versionhawl keyword followed by the function name and parameters. Parameters do not require type annotations. To execute a function, call it by its name and pass the required arguments.// Defining a function
hawl salaan(magac) {
qor("Asalaamu calaykum, " + magac)
}
// Calling the function
salaan("Aamina")# Option 1: Direct Download
soplang --install
# Option 2: Package Manager
soplang --package-managerhawl keyword and return values using the celi keyword.// Define a function that adds two numbers
hawl isuGee(a, b) {
celi a + b
}
// Call the function and print the result
qor(isuGee(2, 3))abn (integers) and jajab (decimals) in operations, the result is typically a jajab. To force a specific type, use the abn() or jajab() casting functions. Using abn() on a decimal result performs truncation.abn a = 5
jajab b = 2.0
// Result is decimal
door c = a + b
qor(c) // 7.0
qor(nooc(c)) // "jajab"
// Force integer (truncation)
abn d = abn(a / b) // 10 / 3 becomes 3
qor(d) // 2
// Force decimal
jajab e = jajab(a * 2)
qor(e) // 10.0door or qoraal.qoraal magac = "Sharafdin Yusuf"
door farriin = "Ku soo dhowow Soplang"haddii), pattern matching (dooro), for-loops (kuceli), and while-loops (intay).// If-Else
haddii (da >= 18) {
qor("Qof weyn")
} ugudambeyn {
qor("Ilmo")
}
// Switch/Match
dooro (qora) {
xaalad "Salaan" { qor("Hello!") }
ugudambeyn { qor("Unknown") }
}
// For loop: (variable start to end :: step)
kuceli (i 1 ilaa 5 :: 2) {
qor(i)
}
// While loop
abn x = 1
intay (x < 3) {
qor(x);
x = x + 1
}walax type. They store structured data as key-value pairs.walax qof = {
magac: "Ayaan",
da: 25,
shaqo: "barayaal"
}haddii keyword functions as if, haddii_kale as else if, and ugudambeyn as else. Each block must be enclosed in curly braces {}. These statements can be nested as needed.abn da = 17
haddii (da >= 18) {
qor("Waad qaan gaadhay")
} haddii_kale (da >= 13) {
qor("Waxaad tahay dhallinyaro")
} ugudambeyn {
qor("Waad yar tahay")
}gelin() always returns a string, use the abn() function to perform type conversion to a number.door da = abn(gelin("Da'daada qor: "))