Featuresโ
HTTP builtin addedโ
The HTTP
builtin has been added which allows to create a builtin webserver
and handle incoming requests.
See HTTP for more information.
Add Ability to marshal Objects to JSON Stringsโ
You can now use .to_json()
to various objects in order to convert them to
their JSON respresentation.
See JSON for more information.
Support for Next and Breakโ
Within a loop you can now use break
and next
for complex control flows.
foreach i in 5
if (i == 2)
next("next")
end
puts(i)
end
foreach i in 5
if (i == 2)
break("break")
end
puts(i)
end
// Returns
0
1
3
4
0
1
"break"
Allow String Multiplicationโ
Support for repeating a string by a given number using the *
operator has been added.
๐ > "test" * 2
=> "testtest"
Allow Integer Iterationโ
Contribution by RaphaelPour
An Integer can now be iterated.
๐ > foreach i in 5 { puts(i) }
0
1
2
3
4
=> 5
Support for Modulo Operatorโ
Modulo has been added as valid operator.
๐ > 5 % 3
=> 1
Support for Ternery Operatorโ
It is now possible to use the ?
operator.
๐ > 4 > 3 ? true : false
=> true
While Loopโ
Contribution by MarkusFreitag
Support for while
has been added.
๐ > a = 0
๐ > while (a != 4)
puts(a)
a = a + 1
end
// which prints
0
1
2
3
=> nil
Improvementsโ
Add Shorthand to convert Float to Integerโ
Contribution by RaphaelPour
The .plz_i()
method has been added to the Float object.
๐ > a = 123.456
=> 123.456
๐ > a.plz_i()
=> 123
Fix Object Index and add support for Index Rangeโ
Contribution by MarkusFreitag
The index operator []
has been fixed for many objects and now supports also ranges.
a = [1, 2, 3, 4, 5]
puts(a[2])
puts(a[-2])
puts(a[:2])
puts(a[:-2])
puts(a[2:])
puts(a[-2:])
puts(a[1:-2])
// should output
[1, 2]
[1, 2, 3]
[3, 4, 5]
[4, 5]
[2, 3]
[1, 2, 8, 9, 5]
Return written bytes on FILE.writeโ
If you write to a file it now returns the written bytes instead of true
.