From 2a7d979226e98617623b550f207cec0e113ff04d Mon Sep 17 00:00:00 2001 From: s-ol Date: Wed, 3 Jun 2020 12:50:20 +0200 Subject: split guide into guide and reference --- docs/guide/basic-types.md | 59 ----------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 docs/guide/basic-types.md (limited to 'docs/guide/basic-types.md') diff --git a/docs/guide/basic-types.md b/docs/guide/basic-types.md deleted file mode 100644 index c22929c..0000000 --- a/docs/guide/basic-types.md +++ /dev/null @@ -1,59 +0,0 @@ -Strings can be written in two ways: using double quotes (`"`), as we did above, -or using single quotes (`'`). In both types of strings, you can escape a quote -that otherwise would signify the end of the string by adding a single backslash -before it. Consequently, backslashes also have to be escaped in the same way. -The following are all valid strings: - - "hello world" - 'hello world' - "it's a beautiful day" - 'it\'s a beautiful day' - "this is a backslash: \\" - "this is a double quote: \"" - "" - '' - -Aside from strings, there are two more types of values that you can use when -writing alv programs: numbers and booleans. Numbers use the digits 0-9 and -can be integers, contain a decimal point, or start or end with a decimal point. -Numbers can start with a negetive sign. The following are all valid numbers: - - 0 - 12 - -7 - 0.1 - 10. - .1 - 123. - -There are only two boolean values, `true` and `false`: - - true - false - -The operator [print][], that we have been using above, only works on strings, -but there is a similar operator called [trace][] that can be used to inspect -any kind of value. It prints the value itself alongside more information, such -as the values type. Give it a try: - - (trace "hello") - (trace 2) - (trace true) - -This will print the following: - - changes to files: values.alv - trace "hello": - trace 2: - trace true: - -On the left side of the colon, [trace][] prints the expression that it is -evaluating. On the right side, three pieces of information are shown: - -- the *type*: `str`, `num`, `bool` -- the *value* itself: `"hello"`, `2`, `true` -- the *kind* of the result: `=` - -`=` means that these values are *constant* - they will not change by themselves -until the code is changed. For simple values like these that seems obvious, but -in `alv` we can also create values tha change over time, as we will see soon. -- cgit v1.2.3