From 00ec41e0a9a87c987a2c6cde94342ff98520d80d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 24 Oct 2022 17:32:01 +0300 Subject: [PATCH] ci: small fix for docs.md --- doc/docs.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 43d78359cf..dfbcc63d7f 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -102,6 +102,7 @@ To do so, run the command `v up`. * [Sum types](#sum-types) * [Type aliases](#type-aliases) * [Option/Result types & error handling](#optionresult-types-and-error-handling) + * [Handling optionals/results](#handling-optionalsresults) * [Custom error types](#custom-error-types) * [Generics](#generics) * [Concurrency](#concurrency) @@ -3502,7 +3503,8 @@ This is a special case of a [sum type](#sum-types) declaration. ### Option/Result types and error handling -Optional types are for types which may represent `none`. Result types may represent an error returned from a function. +Optional types are for types which may represent `none`. Result types may +represent an error returned from a function. `Option` types are declared by prepending `?` to the type name: `?Type`. `Result` types use `!`: `!Type`. @@ -3920,7 +3922,7 @@ A channel can be closed to indicate that no further objects can be pushed. Any a to do so will then result in a runtime panic (with the exception of `select` and `try_push()` - see below). Attempts to pop will return immediately if the associated channel has been closed and the buffer is empty. This situation can be -handled using an or branch (see [Handling Optionals](#handling-optionals)). +handled using an `or {}` block (see [Handling optionals/results](#handling-optionalsresults)). ```v wip ch := chan int{}