Z Sharp

From Esolang
Jump to navigation Jump to search

Z Sharp (Z#), is an interpreted procedural programming language created by user:Sam-astro in 2022. The Z# interpreter was written in C++, and was inspired by the popular languages: C#, Python, and Java.

Features

  • Programs use higher level syntax
  • Z# has a fully functioning interpreter; see External Links at the bottom.
  • If and while statements
  • Types include: int, float, bool, string, along with extra Vec2, Sprite, and Text. All of these are builtin to the interpreter, but will be recreated in Z# once classes are implemented.
  • Functions can return any type, and their input variables can also be of any type.

Example snippet:

func Main() // the main method is the start of the program.
{
    print "Print text to the console with this!"
    int i = 10 // semicolons are not required.
    while i > 0 // brackets for statements have been removed
    {
        i -= 1
        print "Hello " + i + " more times!"
    }
    // foreach and for loops do not exist in Z#, but can be easily emulated using a while loop.
}

Syntax

You can declare a variable with its type, then name, followed by a set operation (=), and its value:

int x = 10

Declare a function with the func keyword, then name, and parenthesis with input variables inside:

func Name(arg)
{
    print arg
}

External Links