|
|
|
@ -12,7 +12,7 @@ Supported operating systems and downloads:
|
|
|
|
|
# Hello World.
|
|
|
|
|
Hello world in Deon.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
|
print["hello world"];
|
|
|
|
@ -24,7 +24,7 @@ call main;
|
|
|
|
|
* Variables support "type juggling" where types are assumed at runtime.
|
|
|
|
|
* Variables can be assigned to each other even if they are different types.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
/* main function */
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
@ -46,7 +46,7 @@ call main;
|
|
|
|
|
* As ov v0.9.5 expressions are only supported for int types, I need to recode the entire expression parsing system
|
|
|
|
|
to support up to doubles.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
|
var = 10 + (5 * 2 / (11 % 2));
|
|
|
|
@ -59,7 +59,7 @@ call main;
|
|
|
|
|
# Scope
|
|
|
|
|
* As of v0.9.5 there is not scope inside of this programming language.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
/* changes var from 10 to 100 */
|
|
|
|
|
def another_function:
|
|
|
|
|
{
|
|
|
|
@ -85,7 +85,7 @@ call main;
|
|
|
|
|
### If statements
|
|
|
|
|
* As stated above, if statement conditions must be a variable.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
|
var = 1;
|
|
|
|
@ -104,7 +104,7 @@ call main;
|
|
|
|
|
|
|
|
|
|
### While loop
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
|
var = 1;
|
|
|
|
@ -121,7 +121,7 @@ call main;
|
|
|
|
|
# Functions
|
|
|
|
|
* Functions can be defined as variables (lambda) or defined normally.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def my_function:
|
|
|
|
|
{
|
|
|
|
|
some_function = {
|
|
|
|
@ -136,13 +136,15 @@ call my_function;
|
|
|
|
|
* As of v0.9.5 everything in this programming language can be redefined. That means everything, including the function that
|
|
|
|
|
is currently being executed.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
```c
|
|
|
|
|
def main:
|
|
|
|
|
{
|
|
|
|
|
main = {
|
|
|
|
|
print["i just redefined main"];
|
|
|
|
|
};
|
|
|
|
|
main = {
|
|
|
|
|
print["i just redefined main"];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
call main;
|
|
|
|
|
call main;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|