How-To Cookbook - SUP Language

## How-To Cookbook

- Print Hello World

    sup
    print "Hello, world!"
    bye

- Define and call a function

    sup
    define function called add with a and b
      return add a and b
    end function
    print call add with 2 and 3
    bye

- Lists and join

    sup
    make list of 1, 2, 3
    print join of "," and list
    bye

- Files, JSON, and regex

    sup
    print json stringify of make list of 1, 2
    print regex replace of "l" and "hello" and "L"
    bye

- Imports and calling a function from a module

    sup
    import mathlib
    print mathlib.pi
    print call mathlib.square with 3
    bye

« Previous Next »