Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Foo : constant := 42;
|
||||
Foo : constant Blahtype := Blahvalue;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
type T is limited private; -- inner structure is hidden
|
||||
X, Y: T;
|
||||
B: Boolean;
|
||||
-- The following operations do not exist:
|
||||
X := Y; -- illegal (cannot be compiled
|
||||
B := X = Y; -- illegal
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
ENVIRONMENT DIVISION.
|
||||
CONFIGURATION SECTION.
|
||||
SPECIAL-NAMES.
|
||||
SYMBOLIC CHARACTERS NUL IS 0, TAB IS 9.
|
||||
|
|
@ -0,0 +1 @@
|
|||
01 Foo CONSTANT AS "Foo".
|
||||
|
|
@ -0,0 +1 @@
|
|||
78 Foo VALUE "Foo".
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CONSTANT SECTION.
|
||||
01 Foo VALUE "Foo".
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
constant n = 1
|
||||
constant s = {1,2,3}
|
||||
constant str = "immutable string"
|
||||
|
|
@ -0,0 +1 @@
|
|||
val x = 123
|
||||
|
|
@ -0,0 +1 @@
|
|||
var x = 123
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
A ← +1
|
||||
F ← A
|
||||
F 1 # -> 2
|
||||
A ← +2
|
||||
F 1 # -> 2 still
|
||||
F ← A
|
||||
F 1 # -> 3 now
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// To change the value of the variable, after making it mutable with "mut", use "=".
|
||||
// To change the value of the variable, after making it mutable with "mut", use "=".
|
||||
|
||||
mut age := 20
|
||||
println(age)
|
||||
|
|
@ -14,20 +14,28 @@ mut:
|
|||
y int
|
||||
}
|
||||
|
||||
// Inside of a function example:
|
||||
// Inside of a function example; struct usage:
|
||||
|
||||
mut p := Point{
|
||||
x: 10
|
||||
y: 20
|
||||
}
|
||||
|
||||
// Function argument example:
|
||||
// Method argument example:
|
||||
|
||||
fn (mut arg Point) register() {
|
||||
println("Show the struct:\n $arg")
|
||||
}
|
||||
|
||||
// V string individual elements are immutable, so we cannot assign to s[i], and will get an error.
|
||||
// V string individual elements are immutable; we cannot assign to s[i], as will cause an error.
|
||||
|
||||
mut s := 'hello'
|
||||
s[0] = m // not allowed
|
||||
|
||||
// Constants are always declared outside of functions in V
|
||||
|
||||
const numbers = [1, 2, 3]
|
||||
|
||||
fn show() {
|
||||
println(numbers)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue