From 1b82501dd0c74347cda4a2c7fe5a84fd610bb485 Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Mon, 7 Apr 2025 06:08:29 +0300 Subject: Add defer statement (#6619) --- docs/user-guide/02-conventional-features.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/user-guide') diff --git a/docs/user-guide/02-conventional-features.md b/docs/user-guide/02-conventional-features.md index aaeea4114..5c15986f8 100644 --- a/docs/user-guide/02-conventional-features.md +++ b/docs/user-guide/02-conventional-features.md @@ -435,6 +435,12 @@ Slang supports the following statement forms with nearly identical syntax to HLS * `return` statements +* `defer` statements + +> #### Note #### +> The `defer` statement in Slang is tied to scope. The deferred statement runs at the end of the scope like in Swift, not just at the end of the function like in Go. +> `defer` supports but does not require block statements: both `defer f();` and `defer { f(); g(); }` are legal. + > #### Note #### > Slang does not support the C/C++ `goto` keyword. -- cgit v1.2.3