tsuki-lang / tsuki

An elegant, robust, and efficient programming language, that just lets you get things done.
MIT License
29 stars 2 forks source link

Named blocks #10

Open liquidev opened 2 years ago

liquidev commented 2 years ago

Because the language lacks goto, breaking out of a nested loop is quite unreadable:

var done = false
for y in 1..10
   for x in 1..10
      if my_array[x + y * 10] == 0
         done = true
         break
   if done
      break

Therefore, I think that named blocks should be introduced:

block loops
   for y in 1..10
      for x in 1..10
         if my_array[x + y * 10] == 0
            break @loops

Reasoning behind the syntax: