Updated About SMNP Language (markdown)
@@ -9,7 +9,7 @@ parsing and evaluating stages. It means that any type-mismatching
|
||||
will be raised on runtime, when control flow reaches the point of error.
|
||||
|
||||
For example:
|
||||
```
|
||||
```php
|
||||
function foo(n: int) {
|
||||
println(n);
|
||||
}
|
||||
@@ -33,11 +33,11 @@ coercion. You always have to provide correct, expected type.
|
||||
# Comments
|
||||
SMNP language allows you to make comments in the code.
|
||||
It can be done with # character, like:
|
||||
```
|
||||
```php
|
||||
# This is a comment
|
||||
```
|
||||
There is no syntax for multiline comment, but you can of course do something like this:
|
||||
```
|
||||
```php
|
||||
# This is
|
||||
# a multiline
|
||||
# comment
|
||||
@@ -45,7 +45,7 @@ There is no syntax for multiline comment, but you can of course do something lik
|
||||
Note that because of hash-beginning comments you can
|
||||
put a shebang at the very first of your code making it more
|
||||
convenient to execute:
|
||||
```
|
||||
```php
|
||||
#!/usr/bin/smnp
|
||||
println("Hello, world!");
|
||||
|
||||
@@ -58,7 +58,7 @@ SMNP language doesn't require you to delimit instructions, however it is still p
|
||||
and highly recommended, because it helps you to get rid of code ambiguity.
|
||||
|
||||
Example:
|
||||
```
|
||||
```php
|
||||
size = [1, 2, 3].size
|
||||
(size - 1) as i ^ print(i)
|
||||
```
|
||||
@@ -68,7 +68,7 @@ As long as lists don't have size method (but they have size property),
|
||||
error will be raised and you will be able to fix problem. However, ambiguity could be
|
||||
a less obvious and you can stick with debugging code having no idea what is going wrong.
|
||||
To remove ambiguity you can end each instruction with semicolon `;`:
|
||||
```
|
||||
```php
|
||||
size = [1, 2, 3].size;
|
||||
(size - 1) as i ^ print(i); # 01
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user