You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use infix expressions to perform arithmetic operations. Here is an example of using infix expressions:
35
34
36
35
```textwire
@@ -44,15 +43,15 @@ You can use infix expressions to perform arithmetic operations. Here is an examp
44
43
</ul>
45
44
```
46
45
47
-
## Postfix Expressions
46
+
## Postfix
48
47
You can use postfix expressions to increment or decrement a variable. Here is an example of using postfix expressions:
49
48
50
49
```textwire :no-line-numbers
51
50
<span>{{ x++ }}</span> <!-- Increment -->
52
51
<span>{{ x-- }}</span> <!-- Decrement -->
53
52
```
54
53
55
-
## Comparison Expressions
54
+
## Comparison
56
55
Comparison expressions produce a boolean value. Here is an example of using comparison expressions:
57
56
58
57
```textwire :no-line-numbers
@@ -85,19 +84,4 @@ Here is an example of using function calls:
85
84
{{ name.split(" ") }}
86
85
```
87
86
88
-
> You can read more detail about built-in functions on the [Built-in Functions](/v3/functions/guide) page.
89
-
90
-
## Variable Declaration
91
-
92
-
You can assign and declare variables by using the `=` operator. Here is an example of declaring variables:
93
-
94
-
```textwire :no-line-numbers
95
-
{{ x = 5 }}
96
-
{{ x = 10 }}
97
-
```
98
-
99
-
You cannot assign values to variables of a different type. For example, you cannot do <codev-pre>{{ x = "Hello"; x = 3 }}</code> because `x` is a string and then you are trying to assign an integer to it. In Textwire, you don't need to declare type of a variable, it will be automatically inferred from the value that you assign to it.
100
-
101
-
:::tip Declaration Has No Output
102
-
Variable declaration statements are not expressions! They don't return any value and can't be used inside of other expressions. Therefore, they don't print anything to the output.
103
-
:::
87
+
You can read more detail about built-in functions on the [Functions Guide](/v3/functions/guide) page.
Copy file name to clipboardExpand all lines: docs/versions/v3/language-elements/literals.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,11 @@ You can use string literals and concatenate them with other strings. You can use
20
20
{{ "Hello" + 'World!' }}
21
21
```
22
22
23
-
> When you print a string, it will be automatically escaped. If you want to print a string without escaping it, you can use the [raw()](/v3/functions/str#raw) function on strings. Example: <codev-pre>{{ "<h1>Test</h1>".raw() }}</code>
23
+
When you print a string, it will be automatically escaped. If you want to print a string without escaping it, you can use the [raw()](/v3/functions/str#raw) function on strings. Example:
24
+
25
+
```textwire :no-line-numbers
26
+
{{ "<h1>Test</h1>".raw() }}
27
+
```
24
28
25
29
## Integer
26
30
You can use integer literals and perform arithmetic operations with them. Here is an example of using integer literals:
-[Comments](#comments) <codev-pre>{{-- This is a Textwire comment --}}</code>
10
+
-[Variable Declaration](#variable-declaration) <codev-pre>{{ x = 5 }}</code>
10
11
11
12
## Trailing Commas
12
13
@@ -34,3 +35,18 @@ You can use comments in Textwire to write notes or to comment out code. Here is
34
35
```
35
36
36
37
HTML comment will be displayed in the final HTML output, but Textwire comment will be removed from the final HTML output. It might be useful when you want to comment out some code that you don't want to be displayed in the final HTML output.
38
+
39
+
## Variable Declaration
40
+
41
+
You can assign and declare variables by using the `=` operator. Here is an example of declaring variables:
42
+
43
+
```textwire :no-line-numbers
44
+
{{ x = 5 }}
45
+
{{ x = 10 }}
46
+
```
47
+
48
+
You cannot assign values to variables of a different type. For example, you cannot do <codev-pre>{{ x = "Hello"; x = 3 }}</code> because `x` is a string and then you are trying to assign an integer to it. In Textwire, you don't need to declare type of a variable, it will be automatically inferred from the value that you assign to it.
49
+
50
+
:::tip Declaration Has No Output
51
+
Variable declaration statements are not expressions! They don't return any value and can't be used inside of other expressions. Therefore, they don't print anything to the output.
0 commit comments