Want to see what the Jinx language looks like? Here we show off a few examples to give you an idea of the look and feel of the language.
Hello World!
Let’s start with the traditional “hello world” program. We see a few basic features of the language here, such as how to import a library, single line comments, and basic output logging. Unlike many language, Jinx imposes no significant restriction on the use of whitespace in variables and function names. Note that the “write line” function contains a space in the name.-- Use the core libraryimport core-- Write to the default outputwrite line "Hello, world!"
Assignments and Types
There are six common types used in Jinx, as well as a few lesser-used types. Here we assign six constant values to six variables, all of different types.set var1 to null-- null typeset var2 to 123.456-- number typeset var3 to 42-- integer typeset var4 to false-- boolean typeset var5 to "a string value"-- string typeset var6 to "red", "green", "blue"-- collection type
FizzBuzz
In this example, we demonstrate basic function syntax, loops and if-branching, as well as an example of a variable with whitespace in the name. The program is an implementation of “FizzBuzz”, a game in which the words “Fizz” or “Buzz” are called out based on the whether a particular number in a sequence is divisible by 3 or 5. Note how the Jinx script compares to the examples in the Wikipedia article on pseudocode, which happens to demonstrate this particular code in various pseudocode styles. Jinx was intentionally designed to look similar to traditional forms of pseudocode, eschewing complex symbols and functionality in favor of simplicity and straightforward syntax.import corefunction {integer x} is divisible by {integer y}return x % y = 0endloop i from 1 to 100set print number to trueif i is divisible by 3write "Fizz"set print number to falseendif i is divisible by 5write "Buzz"set print number to falseendif print numberwrite iendwrite newlinewaitend
Want to see what the Jinx language looks like? Here we show off a few examples to give you an idea of the look and feel of the language.
Hello World!
Let’s start with the traditional “hello world” program. We see a few basic features of the language here, such as how to import a library, single line comments, and basic output logging. Unlike many language, Jinx imposes no significant restriction on the use of whitespace in variables and function names. Note that the “write line” function contains a space in the name.-- Use the core libraryimport core-- Write to the default outputwrite line "Hello, world!"
Assignments and Types
There are six common types used in Jinx, as well as a few lesser-used types. Here we assign six constant values to six variables, all of different types.set var1 to null-- null typeset var2 to 123.456-- number typeset var3 to 42-- integer typeset var4 to false-- boolean typeset var5 to "a string value"-- string typeset var6 to "red", "green", "blue"-- collection type
FizzBuzz
In this example, we demonstrate basic function syntax, loops and if-branching, as well as an example of a variable with whitespace in the name. The program is an implementation of “FizzBuzz”, a game in which the words “Fizz” or “Buzz” are called out based on the whether a particular number in a sequence is divisible by 3 or 5. Note how the Jinx script compares to the examples in the Wikipedia article on pseudocode, which happens to demonstrate this particular code in various pseudocode styles. Jinx was intentionally designed to look similar to traditional forms of pseudocode, eschewing complex symbols and functionality in favor of simplicity and straightforward syntax.import corefunction {integer x} is divisible by {integer y}return x % y = 0endloop i from 1 to 100set print number to trueif i is divisible by 3write "Fizz"set print number to falseendif i is divisible by 5write "Buzz"set print number to falseendif print numberwrite iendwrite newlinewaitend