-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataTypesReferencia.sol
More file actions
57 lines (37 loc) · 1013 Bytes
/
DataTypesReferencia.sol
File metadata and controls
57 lines (37 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract dataTypeReferencia{
//Array fijo
uint[] public numeros;
//Array dinámico
int[3] public cantidades;
//miembros de Arrays
//Length - Tamaño
uint numerosL = numeros.length;
//Push - Añadir. Pop - Sacar
function numerosMiembros() public{
numeros.push(5);
numeros.push(6);
numeros.pop();
numerosL = numeros.length;
}
//Struct
struct Persona{
bool vacunado;
uint8 edad;
bytes32 nombre;
}
Persona public p1 = Persona(true, 30, "Lizeth");
Persona public p2 = Persona({
edad: 30,
vacunado: false,
nombre: "Luis"
});
uint8 public getEdad = p1.edad;
/**************/
//Mapping - mapping(_KeyType => _ValueType) [keyTipe] = valueType
mapping(address => Persona) public diccPersona;
function addPersona() public {
diccPersona[msg.sender] = p1;
}
}