-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Delta456/patch-1
[WIP] Follow #25 and more progress
- Loading branch information
Showing
11 changed files
with
334 additions
and
91 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
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
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,108 @@ | ||
# Array Functions | ||
|
||
## `repeat` | ||
|
||
Syntax | ||
|
||
```go | ||
Type[element].repeat(number int) | ||
``` | ||
|
||
Makes an array with the given element number of times. | ||
|
||
```go | ||
foo := int[1].repeat(7) | ||
println(foo) | ||
``` | ||
Output | ||
|
||
```go | ||
[1, 1, 1, 1, 1, 1, 1] | ||
``` | ||
|
||
## insert | ||
|
||
Syntax | ||
|
||
```go | ||
array.insert(num int, data T) | ||
``` | ||
|
||
Inserts the data at a given position and shifts the elements in the array | ||
|
||
```go | ||
names := ['Samuel', 'John', 'Peter'] | ||
names.insert(2,'Tom') | ||
println(names) | ||
``` | ||
|
||
Output | ||
|
||
```go | ||
['Samuel', 'John', 'Tom', 'Peter'] | ||
``` | ||
|
||
## `delete` | ||
|
||
Syntax | ||
|
||
```go | ||
array.delete(element T) | ||
``` | ||
|
||
Deletes the element present in the array | ||
|
||
```go | ||
even_numbers = [2, 4, 6, 8, 10] | ||
even_numbers.delete(8) | ||
println(even_number) | ||
``` | ||
|
||
Output | ||
|
||
```go | ||
[2, 4, 6, 10] | ||
``` | ||
|
||
## `reverse` | ||
|
||
Syntax | ||
|
||
```go | ||
array.reverse() | ||
``` | ||
|
||
Reverses the array | ||
|
||
```go | ||
float_num := [1.1, 1.3, 1.25, 1.4] | ||
float_num.reverse() | ||
``` | ||
|
||
Output | ||
|
||
```go | ||
[1.4, 1.25, 1.3, 1.1] | ||
``` | ||
|
||
## `clone` | ||
|
||
Syntax | ||
|
||
```go | ||
array.clone() | ||
``` | ||
|
||
Clones and returns a new array | ||
|
||
```go | ||
foo := [1, 2, 4, 5, 4, 6] | ||
foo1 := foo.clone() | ||
println(foo1) | ||
``` | ||
|
||
Output | ||
|
||
```go | ||
[1, 2, 4, 5, 4, 6] | ||
``` |
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
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
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,12 @@ | ||
## Comments | ||
|
||
V supports single line comments `//` and multi-line comments `/* */`. They should be used for documenting the code for letting the other users know how the code works. It can also be used for temporarily commenting the code which has to be used later on. | ||
|
||
```go | ||
// This is a single line comment | ||
|
||
/* This is a | ||
* multi-line comment | ||
* /* This could be nested as well*/ | ||
*/ | ||
``` |
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
Oops, something went wrong.