Jump to content

BSL:Manual: Difference between revisions

238 bytes added ,  6 December 2015
→‎Loop: wording; mentioning "fork" (duh)
(→‎Recursive calling: explaining difference between recursive calling and using "fork" to get a loop)
(→‎Loop: wording; mentioning "fork" (duh))
Line 190: Line 190:


===Loop===
===Loop===
BSL has no "for" or "while" statement, but "schedule-repeat-every" (see [[#Concurrency|Concurrency]]) can be used as a poor-man's loop (as long as you realize that there's no way to exit early).
It is generally desirable in any program to be able to run the same code over and over, such as repeatedly spawning enemies. This is one of BSL's biggest limitations, as it has no conventional loop statement like C's "for" or "while", but there are two indirect methods for looping: (1) use "fork" on a function (see the section on [[#Looping|looping functions]]), and (2) "schedule-repeat-every" (see [[#Concurrency|Concurrency]]).


===Multi-threading===
===Multi-threading===