Soplang Documentation

website·Indexed 29 days ago

https://soplang-update.vercel.app

Soplang is a Somali-first programming language designed to make coding intuitive and accessible. The documentation covers core language features including variable declarations (door), functions (hawl), objects (walax), and control flow using Somali keywords such as intay (while), kuceli (for), and haddii (if). It provides guides on primitive types, arrays, arithmetic operators, and built-in functions, with updates available for Soplang 2.0.

Tokens
7.6K
Snippets
68
Records
79
Agent score
73%

What's inside Soplang

  1. Overview of Soplang 2.0 language features

    Soplang is a general-purpose, Somali-first programming language designed to make software development accessible to Somali speakers by using native linguistic conventions for its syntax. Key language features include:

    • Dual Typing System: Support for both static and dynamic typing.
    • Object-Oriented Programming: Implemented via fasalka (class) and ka_dhaxal (inheritance).
    • Control Flow: Uses haddii (if), celi (repeat/loop), and iska_joog (break/stop).
    • Error Handling: Implements try/catch semantics using isku_day and qabo.
    • Variable & Function Declarations: Uses door for variables and hawl for functions.
  2. Overview of Soplang programming language

    Soplang (Somali Programming Language) is a culturally-rooted, Somali-first programming language that allows developers to write code using native Somali syntax, keywords, and expressions. It is designed to make programming intuitive and accessible by removing English-language barriers for Somali speakers.
  3. Overview of Soplang

    Soplang (Somali Programming Language) is a culturally-rooted, Somali-first programming language. It allows developers to write code using native Somali syntax, keywords, and expressions to make programming more intuitive and accessible for Somali speakers.
  4. Soplang 2.0 New Features Overview

    Soplang 2.0 introduces several enhancements:

    • Advanced Math Functions: New capabilities in the standard library for complex calculations.
    • Smarter Error Messages: Contextual hints for faster debugging.
    • Performance: Up to 50% faster execution speeds.
    • Web API Framework: Built-in tools for developing backend applications.
    • Documentation: Comprehensive guides available in English and Somali.
  5. Convert and mix Integers (abn) and Decimals (jajab)

    When performing operations between abn and jajab, the result is typically a jajab. You can explicitly cast values using abn() for truncation to an integer or jajab() to ensure a decimal result.
    abn a = 5
    jajab b = 2.0
    
    // Mixed operation results in jajab
    door c = a + b
    qor(c) // 7.0
    qor(nooc(c)) // "jajab"
    
    // Explicitly cast to integer (truncation)
    abn d = abn(a / b)
    qor(d) // 2
    
    // Explicitly cast to decimal
    jajab e = jajab(a * 2)
    qor(e) // 10.0
  6. Manage control flow in Soplang

    Soplang provides keywords for conditional logic and looping. Conditionals use haddii (if), haddii_kale (else if), and ugudambeyn (else). Switch statements use dooro (switch) with xaalad (case) clauses. Loops include kuceli (for) with ilaa (to) and :: (step/increment), and intay (while). Loop control is handled by jooji (break) and soco (continue).
    // If/Else
    haddii (x > 10) { qor("Weyn") }
    haddii_kale (x == 10) { qor("Dhexe") }
    ugudambeyn { qor("Yar") }
    
    // Switch
    dooro (x) { 
      xaalad 1 { qor("Hal") } 
    }
    
    // For loop (from 1 to 5, step 2)
    kuceli (i 1 ilaa 5 :: 2) { qor(i) }
    
    // While loop
    intay (x < 5) { qor(x) }
    
    // Break and Continue
    haddii (x == 3) { jooji } // break
    haddii (x == 3) { soco }   // continue
  7. Work with Decimals (jajab) in Soplang

    The jajab type represents floating-point/decimal numbers. Like integers, they can be declared statically with jajab or dynamically with door. You can use the nooc() function to verify if a dynamic variable is a jajab type.
    // Literals & declaration
    jajab pi = 3.14159
    door qiime = 2.5 // dynamic, decimal value
    
    // Arithmetic
    jajab x = 10.0
    jajab y = 4.0
    qor(x + y) // 14.0
    qor(x - y) // 6.0
    qor(x * y) // 40.0
    qor(x / y) // 2.5
    
    // Comparisons
    qor(pi > 3) // run
    qor(2.0 == 2) // run
    
    // Type verification
    door n = 2.75
    qor(nooc(n)) // "jajab"
  8. Implement multi-branch logic using Switch-Case in Soplang

    For clear branching based on a single value, Soplang provides the dooro (switch), xaalad (case), and ugudambeyn (default) keywords. This is recommended for decision-making based on fixed values.
    qoraal maalinta = "Jimce"
    
    dooro (maalinta) {
        xaalad "Isniin" {
            qor("Todobaad cusub")
        }
        xaalad "Jimce" {
            qor("Waqti nasasho")
        }
        // default case
        ugudambeyn {
            qor("Maalin kale")
        }
    }
  9. Implement conditional logic using if, else if, and else in Soplang

    Soplang uses Somali keywords for conditional execution. The haddii keyword functions as if, haddii_kale functions as else if, and ugudambeyn functions as else. Each block must be enclosed in curly braces {}. These blocks can be nested or chained 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")
    }