A step-by-step guide to developing with Neuron.
With
installed, type the following into your command line:npm
npm install --global neuron-lang
Create a file with the name
main.neuron
. This will contain our program. In the command line, navigate to the directory with the file:cd path/to/main.neuron
In
main.neuron
, type the following:sayHello {
log(Hello #0!);
}
This is the standard function and object syntax, with
#0
being the first parameter passed as an argument to the function sayHello
. The function can now be called as follows:sayHello(world);
This will now log “Hello world!”
We can create a new function that can return a value as well. In main.neuron:
sayHello {
return(Hello #0); // or return: Hello #0
}
log([sayHello => world] in Neuron!);
When run in the command line with
neuron main.neuron
, it should log “Hello world in Neuron!”Now we can pipe the output of another function into our
sayHello
function:add {
return(#0 plus #1 is [#0 + #1].);
}
sayHello {
log(Hello! It appears as though [add => #0 #1]!);
}
sayHello(0, 1);
The output of our program should be “Hello! It appears as though 0 plus 1 is 1.”
We can further extend the capabilities of our program with iterators:
for (i => 10) {
sayHello(#i, [#i - 1]);
}
This will now log “Hello! It appears as though 0 plus -1 is 0.” and “Hello! It appears as though 1 plus 0 is 1.” until the iterator, represented by
#i
, has reached nine.Other features of the Neuron programming language capable of being integrated in our program include conditionals, variables, iterators, and objects.
With Neuron installed through
, the file can be executed as such:npm
neuron main.neuron
Neuron can be used for web applications in the browser as well. Neuron is an incredibly efficient language for front-end web development. If you are interested in the Neuron language and would like to know more, visit the repository. The documentation contains information about the Neuron language, various tutorials, and a reference for the Neuron language. Neuron is currently under heavy development, and your contributions and support are welcome!