by Isaac Shelton
Static language that uses indentation for blocks.

Boomslang aims to bring meaningful indentation to static programming languages. It compiles down to C++ and has native integration with C and C++ libraries.

Features include:

  • Type Inference
  • Object Primitives
  • Until & Unless conditionals
  • Generics
  • Inheritance
  • Static Methods
def isValidOperator(String operator)
    unless operator = "+" or operator = "-" or operator = "*" or operator = "/"
        return false
    else
        return true

def getResult(Double value_1, String operator, Double value_2)
    if operator = "+"
        return value_1 + value_2
    else if operator = "-"
        return value_1 - value_2
    else if operator = "*"
        return value_1 * value_2
    else if operator = "/"
        unless value_2 = 0
            return value_1 / value_2
        else
            return 0
    else
        return 0

def main()
    Double value_1
    Double value_2
    Double result
    String operator
    
    # Get Value 1
    "Enter a value: ".print()
    value_1.input()
    
    # Get Operator
    "Enter an operator: ".print()
    operator.input()
    
    # Ensure Operator is Valid
    unless isValidOperator(operator)
        ("Invalid operator '" + operator + "', accepted operators include '+', '-', '*', and '/'").fail()
        die()
    
    # Get Value 2
    "Enter another value: ".print()
    value_2.input()
    
    # Show Result
    result = getResults(value_1, operator, value_2)
    ("The result is: " + result.toString()).output()
Information updated 01/03/17
View Comments