-
Notifications
You must be signed in to change notification settings - Fork 6
Return and Break
Shane Brinkman-Davis Delamore edited this page Mar 6, 2019
·
1 revision
As-of v0.69.0 we have basic return and break support. These work pretty-much everywhere you'd expect except in comprehensions. Currently there is no support for return or break in comprehensions. However, return works in if-statements, while-statements and function-bodies. break works in while statements and has functionality beyond normal JavaScript: it can take a value to return.
Examples:
count = 0
stopAt = 50
while count < 100
break if count == stopAt
(stopEarly) ->
return true if stopEarly
foo()count = 0
stopAt = 50
a = while count < 100
break 123 if count == stopAt
# a == 123- Home
- Get Started
- Benefits
- Highlights
- Productivity by Design
- CaffeineScript Design
- What is CaffeineScript Good For?
- Get the most out of JavaScript
- Language Comparison
- CHANGELOG
- Blocks Instead of Brackets
- Binary Line-Starts
- Everything Returns a Value
- Streamlined Modules
- Scopes and Variables
- Optional Commas
- Semantics
- Ambiguities