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
Copy file name to clipboardExpand all lines: SYNTAX.md
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Look at the following code, to understand it better:
24
24
25
25
### Example
26
26
27
-
```solidity
27
+
```cellscript
28
28
package main
29
29
import "debug"
30
30
@@ -49,7 +49,7 @@ CellScript supports single-line or multi-line comments.
49
49
50
50
### Single-line Comments
51
51
52
-
```
52
+
```cellscript
53
53
// This is a comment
54
54
package main
55
55
import ("fmt")
@@ -94,19 +94,19 @@ Variable naming rules:
94
94
95
95
#### `var` keyword
96
96
97
-
```
97
+
```cellscript
98
98
var variablename type = value
99
99
```
100
100
101
101
#### `:=` sign
102
102
103
-
```
103
+
```cellscript
104
104
variablename := value
105
105
```
106
106
107
107
#### Variable Declaration With Initial Value
108
108
109
-
```
109
+
```cellscript
110
110
package main
111
111
import ("fmt")
112
112
@@ -125,7 +125,7 @@ func main() {
125
125
126
126
In Go, all variables are initialized. So, if you declare a variable without an initial value, its value will be set to the default value of its type:
127
127
128
-
```
128
+
```cellscript
129
129
package main
130
130
import ("fmt")
131
131
@@ -150,7 +150,7 @@ The `const` keyword declares the variable as "constant", which means that it is
150
150
151
151
### Declaring a Constant
152
152
153
-
```
153
+
```cellscript
154
154
package main
155
155
import ("fmt")
156
156
@@ -168,7 +168,7 @@ There are three functions to output text:
168
168
*`Println()`
169
169
*`Printf()`
170
170
171
-
```
171
+
```cellscript
172
172
package main
173
173
import ("debug")
174
174
@@ -184,7 +184,7 @@ function main() {
184
184
185
185
Arrays are used to store multiple values of the same type in a single variable, instead of declaring separate variables for each value.
186
186
187
-
```
187
+
```cellscript
188
188
var array_name = [length]datatype{values} // here length is defined
189
189
array_name := [length]datatype{values} // here length is defined
190
190
```
@@ -193,7 +193,7 @@ array_name := [length]datatype{values} // here length is defined
193
193
194
194
An vector is a numbered sequence of elements of a single type, called the element type. The number of elements is called the length of the vector and is never negative.
195
195
196
-
```
196
+
```cellscript
197
197
vector_name := []datatype{values}
198
198
```
199
199
@@ -232,7 +232,7 @@ To create (often referred to as declare) a function, do the following:
232
232
* Specify a name for the function, followed by parentheses ().
233
233
* Finally, add code that defines what the function should do, inside curly braces {}.
234
234
235
-
```
235
+
```cellscript
236
236
function FunctionName() {
237
237
// code to be executed
238
238
}
@@ -242,7 +242,7 @@ function FunctionName() {
242
242
243
243
Functions are not executed immediately. They are "saved for later use", and will be executed when they are called.
244
244
245
-
```
245
+
```cellscript
246
246
package main
247
247
import ("debug")
248
248
@@ -263,15 +263,15 @@ Each execution of a loop is called an **iteration** .
263
263
264
264
The `for` loop can take up to three statements:
265
265
266
-
```
266
+
```cellscript
267
267
for statement1; statement2; statement3 {
268
268
// code to be executed for each iteration
269
269
}
270
270
```
271
271
272
272
Example
273
273
274
-
```
274
+
```cellscript
275
275
package main
276
276
import ("fmt")
277
277
@@ -288,7 +288,7 @@ A table is a sequence of named elements, called fields, each of which has a name
288
288
289
289
To declare a structure in CellScript, use the `type` and `struct` keywords:
0 commit comments