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
-[Palabras clave de V](en/examples/section_1/keywords.md)
@@ -23,47 +23,48 @@ Introduction to V by presenting a few basic examples and exercises.
23
23
-[Cadenas](en/examples/section_1/strings.md)
24
24
-[Comentarios](en/examples/section_1/comment.md)
25
25
26
-
## Section 2
26
+
## Sección 2
27
27
28
-
This section discusses the main operators and conditional statements in V.
28
+
Esta sección discute los principales operadores y las sentencias condicionales en V.
29
29
30
-
-[Operator](en/examples/section_2/operator.md)
30
+
-[Operadores](en/examples/section_2/operator.md)
31
31
-[If-else](en/examples/section_2/if-else.md)
32
32
-[Match](en/examples/section_2/match.md)
33
-
-[Loops](en/examples/section_2/loops.md)
33
+
-[Ciclos](en/examples/section_2/loops.md)
34
34
35
-
## Section 3
35
+
## Sección 3
36
36
37
-
A study on functions and methods and in the most important data structures in V: arrays and struct.
37
+
Un estudio de funciones y métodos y de las estructuras de datos más importantes en V:
38
+
arreglos y estructuras
38
39
39
-
-[Functions](en/examples/section_3/functions.md)
40
-
-[Arrays](en/examples/section_3/arrays.md)
41
-
-[Struct](en/examples/section_3/struct.md)
42
-
-[Methods](en/examples/section_3/methods.md)
40
+
-[Funciones](en/examples/section_3/functions.md)
41
+
-[Arreglos](en/examples/section_3/arrays.md)
42
+
-[Estructuras](en/examples/section_3/struct.md)
43
+
-[Métodos](en/examples/section_3/methods.md)
43
44
44
-
## Section 4
45
+
## Sección 4
45
46
46
-
In this section, we dive deeper and study the features inside the Array object. Other examples like JSON, Writing/reading files and Testing are covered.
47
+
En esta sección, discutimos a profundidad las características de los Objetos typo Arreglo. Otros ejemplos como JSON, Escritura/Lectura de archivos y Pruebas.
-[Funciones de Arreglos](en/examples/section_4/array-functions.md)
50
+
-[Pruebas](en/examples/section_4/testing.md)
51
+
-[Archivos](en/examples/section_4/files.md)
51
52
-[JSON](en/examples/section_4/json.md)
52
53
53
-
## Team
54
+
## Equipo
54
55
55
-
Current list of maintainers/authors:
56
+
Lista de autores y colaboradores:
56
57
57
58
-[Don Alfons Nisnoni](https://github.com/dhonx)
58
59
-[Ivo-Balbaert](https://github.com/ibalbaert)
59
60
-[Sven Patrick Meier](https://github.com/SuicideS3ason)
60
61
-[Swastik Baranwal](https://github.com/Delta456)
61
62
-[Vitor Oliveira](https://github.com/vbrazo)
62
63
63
-
## Contributing
64
+
## Colaborando
64
65
65
-
See our [CONTRIBUTING.md](CONTRIBUTING.md)and start contributing today. We usually elect new maintainers based on contributions.
66
+
Revisa [CONTRIBUTING.md](CONTRIBUTING.md)y empieza a ayudar desde hoy. Generalmente se seleccionan los nuevos colaboradores con base in las contribuciones.
Copy file name to clipboardExpand all lines: es/examples/section_1/strings.md
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,27 @@
1
-
# Strings
1
+
# Cadenas
2
2
3
-
In V one can define strings using the `:=` operator. Strings (like other variables) are immutable by default. One is free to use `""` or `''` to denote a string. When using `vfmt` all double-quoted strings will be converted to single-quoted ones unless it contains a single quote character.
3
+
4
+
En V se pueden definir las cadenas usando el operador `:=`. Las cadenas (como las variables de los otros tipos) son inmutables por defecto. Se puede usar `""` o `''` para denotar los literales tipo cadena. Cuando se usa `vfmt` todas los literales definidos usando comillas dobles se convierten a literales de comillas simples.
4
5
5
6
```go
6
7
name:='Bob'
7
8
println(name) // Bob
8
9
println(name.len) // 3
9
10
```
10
11
11
-
Getting the length of a string works with `.len`.
12
+
Para objetner la longitud de una cadena se usa `.len`.
13
+
14
+
## Interpolación
12
15
13
-
## Interpolation
16
+
Es posible hacer la interpolación de cadenas usando `$` antes del nombre de la variable:
14
17
15
-
It is possible to do string interpolation with `$` in front of the variable:
16
18
17
19
```go
18
20
name:='Bob'
19
21
println('Hello $name!') // Hello Bob!
20
22
```
21
23
22
-
One can have more complex expressions with interpolation syntax by using`${}`:
24
+
Se pueden tener expresiones más complejas con la interpolación usando`${}`:
23
25
24
26
```go
25
27
structUser {
@@ -34,9 +36,9 @@ println('Say Hello to a new User: ${bob.name}, ${bob.age}') // Say H
34
36
println('${bob.name}s age is higher or equal to 18: ${bob.age >= 18}') // 0 <=> number representation for false
Appending to a string works with concatenation as well as with `+=` operator. Since strings are immutable by default it is only possible to do this if they are declared with `mut`.
51
+
Las cadenas se pueden concatenar también con el operador `+=`. Dado que las cadenas son inmutables por defecto esto es sólo posible si la variable se ha declarado `mut`..
50
52
51
53
```go
52
54
mut hello:='Hello '
53
55
hello += 'from V!'// appends 'from V!' to the string stored in hello.
54
56
println(hello) // Hello from V!
55
57
```
56
58
57
-
In V, string data is encoded using UTF-8 and the string itself is a read-only array of bytes. This makes slicing possible, which means we can access single-character literals or slices of a string variable.
59
+
En V, las cadenas son codificadasd usando UTF-8 y las cadenas en si mismas son un arreglo de bytes de sólo lectura. Esto hace que se posible hacer slicing, es decir es posible acceder a los caracteres de forma individual o a slices de la variable typo cadena.
58
60
59
61
```go
60
62
robert:='Robert'
@@ -63,26 +65,26 @@ rob := robert[0..3] // Rob
63
65
println('The persons of interest are: $robert, $bert, $rob') // The persons of interest are: Robert, bert, Rob
64
66
```
65
67
66
-
### Notes
68
+
### Notas
67
69
68
-
When using `some_string[start..end]` syntax the `end`is**not**inclusive.
70
+
Cuando se usa `some_string[start..end]`, `end`es**no**inclusivo.
69
71
70
-
All operators in V must have values of the same type on both sides. The code below will not compile because `age`is an`int`:
72
+
Todos los operadores en V tienen que tener valores del mismo tipo en ambos lados. El código siguiente no compila correctamente, debido a que `age`es de tipo`int`:
71
73
72
74
```go
73
75
age:=25
74
76
println('age = ' + age)
75
77
```
76
78
77
-
We therefore need to convert it to string by using `.str()`or use string interpolation (preferred):
79
+
Es necesario convertir el valor a cadena usando `.str()`o usar interpolación de cadenas (preferido):
78
80
79
81
```go
80
82
age:=25
81
83
println('age = ' + age.str()) // age = 25
82
84
println('age = $age') // age = 25
83
85
```
84
86
85
-
To define character literals use: ` `` `. Raw strings can be defined as prepending `r`. They are not escaped.
87
+
Para definir literales tipo caracter se usa: ` `` `. Cadenas planas se pueden definir usando `r` entes del literal tipo cadena. De este modo la cadena no es escapada.
0 commit comments