Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

feat/fix: Large Book Update #118

Merged
merged 13 commits into from
Mar 19, 2024
31 changes: 23 additions & 8 deletions pages/book/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,43 @@ export default {
guides: 'Guides',
cs: 'Cheatsheets',
cookbook: 'Cookbook',
'--': {
'-- 1': {
type: 'separator',
title: 'Fundamentals of Tact',
},
types: 'Type system overview',
integers: 'Integers',
functions: 'Functions',
operators: 'Operators',
statements: 'Statements',
constants: 'Constants',
functions: 'Functions',
'composite-types': 'Composite types',
receive: 'Receive Messages',
bounced: 'Bounced Messages',
external: 'External Messages',
// <- a place for https://github.com/tact-lang/tact-docs/issues/115
'-- 2': {
type: 'separator',
title: 'Communication',
},
// <- NOTE
// potential place for a rather short overview page describing asyncronous & actor-model nature
// of TON Blockchain with respect to Tact and exchanging messages with it
receive: 'Receive messages',
bounced: 'Bounced messages',
external: 'External messages',
lifecycle: 'Message lifecycle',
send: 'Sending messages',
'message-mode': 'Message mode',
deploy: 'Deploy contracts',
'-- 3': {
type: 'separator',
title: 'Going places',
},
deploy: 'Deployment',
debug: 'Debugging',
upgrades: 'Contract upgrades',
import: 'Importing code',
masterchain: 'Masterchain',
func: 'Compatibility with Func',
config: 'Configuration',
masterchain: 'Using masterchain',
func: 'Compatibility with FunC',
'exit-codes': 'Exit codes',
programmatic: 'Programmatic API',
'-- Community': {
type: 'separator',
Expand Down
6 changes: 3 additions & 3 deletions pages/book/composite-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ As it was mentioned in [type system overview](/book/types), most [primitive type

[Variables](/book/statements#variable-declaration) or fields of [Structs](#structs) and [Messages](#messages) that can hold `null{:tact}` are called "optionals". They're useful to reduce state size when the variable isn't necesserily used.

You can make any variable an optional by adding a question mark (`?`) after its type declaration. The only exceptions are [`map<>{:tact}`](/book/types#maps) and [`bounced<>{:tact}`](/book/bounced#bounced-messages-in-tact), where you can't make them, inner key/value type (in case of a map) or the inner [Message](#messages) (in case of a bounced) optional.
You can make any variable of field an optional by adding a question mark (`?{:tact}`) after its type declaration. The only exceptions are [`map<>{:tact}`](/book/types#maps) and [`bounced<>{:tact}`](/book/bounced#bounced-messages-in-tact), where you can't make them, inner key/value type (in case of a map) or the inner [Message](#messages) (in case of a bounced) optional.
novusnota marked this conversation as resolved.
Show resolved Hide resolved

Optional variables that are not defined hold the `null{:tact}` value by default. You cannot access them without checking for `null{:tact}` first. But if you're certain the optional variable is not `null{:tact}`, use the non-null assertion operator (`!!`, also called double-bang or double exclamation mark operator) to access its value.
Optional variables or optional fields that are not defined hold the `null{:tact}` value by default. You cannot access them without checking for `null{:tact}` first. But if you're certain they are not `null{:tact}` at a given moment, use the non-null assertion operator (`!!{:tact}`) to access their value.

Trying to access the value of an optional variable without using `!!` or checking for `null{:tact}` beforehand will result in a compilation error.
Trying to access the value of an optional variable or an optional field without using `!!{:tact}` or without checking for `null{:tact}` beforehand will result in a compilation error.

Example of optionals:

Expand Down
Loading
Loading