-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an CX chain example that uses slices.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package bc | ||
|
||
var numbers []i32 | ||
var texts []str | ||
|
||
package main | ||
import "bc" | ||
|
||
func main () { | ||
// Initializing our CX chain numbers. | ||
bc.numbers = append(bc.numbers, 1) | ||
bc.numbers = append(bc.numbers, 2) | ||
bc.numbers = append(bc.numbers, 3) | ||
bc.numbers = append(bc.numbers, 4) | ||
|
||
// Initializing our CX chain texts. | ||
bc.texts = append(bc.texts, "Once") | ||
bc.texts = append(bc.texts, "upon") | ||
bc.texts = append(bc.texts, "a") | ||
bc.texts = append(bc.texts, "time") | ||
|
||
// Just checking that our values are there | ||
i32.print(bc.numbers[0]) | ||
i32.print(bc.numbers[1]) | ||
i32.print(bc.numbers[2]) | ||
i32.print(bc.numbers[3]) | ||
|
||
str.print(bc.texts[0]) | ||
str.print(bc.texts[1]) | ||
str.print(bc.texts[2]) | ||
str.print(bc.texts[3]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package main | ||
import "bc" | ||
|
||
func main () { | ||
bc.numbers = append(bc.numbers, 5) | ||
bc.numbers = append(bc.numbers, 6) | ||
|
||
// Print all the numbers that have been added in transactions. | ||
for c := 0; c < len(bc.numbers); c++ { | ||
i32.print(bc.numbers[c]) | ||
} | ||
|
||
bc.texts = append(bc.texts, "in") | ||
bc.texts = append(bc.texts, "Wonderland") | ||
|
||
// Print all the texts that have been added in transactions. | ||
for d := 0; d < len(bc.texts); d++ { | ||
str.print(bc.texts[d]) | ||
} | ||
} |