An abstract, extendable programing language on top of JavaScript
> Comes with ready-to-use features for any purpose
Important: The puzzle project is in early stage and under development. It's not yet production ready. If you'd like to contribute to the code or the module ecosystem, feel free to open a PR.
``puzzle`
every(1000).print('hello world')
PUZZLE runs in any JavaScript environment, including Node and Browsers.
> Node
`shell`
$ npm i puzzlelang --global`javascript
const puzzle = require('puzzlelang');
print('hello')
`
> Browsers
`html`
`javascript`
print('hello')
Variables can be defined either the JavaScript way or using puzzle syntax
`javascript
// with JavaScript
var name = 'Peter';
// with Puzzle
set('name', 'Peter')
print(name)
`
Persistend variables are stored locally
`javascript`
set('name', 'Peter').local()
Like variables, functions can also be defined either the JavaScript way or using puzzle syntax
`javascript
set('sayHello', (name) => {
print('hello ' + name)
})
// With JavaScript
var sayHello = () => {
print('hello')
}
`
Functions can be scheduled
`javascript
// Repeat every X milliseconds
every(2000).run(sayHello)
// Repeat X times
repeat(10).run(sayHello)
// Run after X milliseconds
after(10000).run(sayHello)
`
Loops can iteragte over data (arrays)
`javascript
var array = [1,2,3]
loop.over(data).do(it => {
print(it)
})
`
`javascript``
// min and max
min([1,4,6,7]).as('result')
max([4,7,8,2]).as('result')