You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DreamBerd has a built-in garbage collector that will automatically clean up unused variables. However, if you want to be extra careful, you can specify a lifetime for a variable, with a variety of units.
constconstname<2> = "Luke"! //lasts for two linesconstconstname<20s> = "Luke"! //lasts for 20 seconds
By default, a variable will last until the end of the program. But you can make it last in between program-runs by specifying a longer lifetime.
Variable hoisting can be achieved with this neat trick. Specify a negative lifetime to make a variable exist before its creation, and disappear after its creation.
print(name)! //Lukeconstconstname<-1> = "Luke"!
The text was updated successfully, but these errors were encountered:
Lifetimes
DreamBerd has a built-in garbage collector that will automatically clean up unused variables. However, if you want to be extra careful, you can specify a lifetime for a variable, with a variety of units.
By default, a variable will last until the end of the program. But you can make it last in between program-runs by specifying a longer lifetime.
Variable hoisting can be achieved with this neat trick. Specify a negative lifetime to make a variable exist before its creation, and disappear after its creation.
The text was updated successfully, but these errors were encountered: