From aec2f3f496d55fbf0d761f53be34c2cabdb9fead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Pi=C4=85tkowski?= Date: Mon, 9 Jan 2023 10:03:39 +0100 Subject: [PATCH] add example --- musique/interpreter/builtin_functions.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/musique/interpreter/builtin_functions.cc b/musique/interpreter/builtin_functions.cc index deb8b68..0e57747 100644 --- a/musique/interpreter/builtin_functions.cc +++ b/musique/interpreter/builtin_functions.cc @@ -846,7 +846,15 @@ static Result builtin_while(Interpreter &i, std::span args) { //: //: # Przykład //: ``` -//: TODO +//: > try (nprimes -1) (say 0) +//: 0 +//: > try (nprimes 2) (say 0) +//: (2, 3) +//: ``` +//: # W przypadku przekazania jednego bloku jako argumentu `try` zwróci pustą wartość w przypadku napotkania błędu podczas wykonania tego bloku. +//: ``` +//: > try (nprimes -1) +//: > //: ``` /// Try executing all but last block and if it fails execute last one static Result builtin_try(Interpreter &interpreter, std::span args)