mirror of
https://github.com/Reuh/candran.git
synced 2025-10-27 09:59:29 +00:00
Added let and continue
This commit is contained in:
parent
5194cfb115
commit
c0f7934d92
10 changed files with 316 additions and 119 deletions
24
ideas.txt
24
ideas.txt
|
|
@ -40,23 +40,6 @@ local a = new Thing()
|
|||
->
|
||||
(TODO: define how classes work. May even use ClassCommons)
|
||||
|
||||
* continue keyword for loops
|
||||
while true do
|
||||
stuff()
|
||||
if thing then
|
||||
continue
|
||||
end
|
||||
end
|
||||
->
|
||||
while true do
|
||||
repeat
|
||||
stuff()
|
||||
if thing then
|
||||
break
|
||||
end
|
||||
until true
|
||||
end
|
||||
|
||||
* list comprehension
|
||||
local a = [x for x in pairs(stuff)]
|
||||
local a = [x for x in pairs(stuff) if x == true]
|
||||
|
|
@ -91,6 +74,8 @@ local a = if x == true then
|
|||
return a
|
||||
end
|
||||
|
||||
With implicits returns?...
|
||||
|
||||
local stuff = for ... (accumulate in a table)
|
||||
|
||||
* try / except|catch / finally / else / other keywords
|
||||
|
|
@ -139,11 +124,6 @@ local x, y $= pos
|
|||
And in implicit assignments:
|
||||
for i, {x, y} in ipairs(positions) do
|
||||
|
||||
* local short alias
|
||||
let a -> local a
|
||||
or
|
||||
var a
|
||||
|
||||
* Other potential inspiration
|
||||
https://love2d.org/forums/viewtopic.php?f=3&t=82650&sid=b6d9a8dec64afcc1c67806cb5ba65458
|
||||
https://www.ruby-lang.org/fr/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue