File tree Expand file tree Collapse file tree
es/06_ArreglosyEstructuras_es Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ contract StructTypes {
4545 // Asignar el valor a una struct
4646 // Método 1: Se crea una referencia storage struct en la función
4747 function initStudent1 () external {
48- Student storage _student = student; // Asignar una copia de estudiante
48+ Student storage _student = student; // Asignar una referencia al estudiante
4949 _student.id = 11 ;
5050 _student.score = 100 ;
5151 }
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ Hay 4 maneras de asignar valores a un `struct`:
9797 // Asignar el valor a una struct
9898 // Método 1: Se crea una referencia storage struct en la función
9999 function initStudent1() external{
100- Student storage _student = student; // Asigna una copia de student
100+ Student storage _student = student; // Asigna una referencia a student
101101 _student.id = 11;
102102 _student.score = 100;
103103 }
Original file line number Diff line number Diff line change @@ -39,11 +39,12 @@ contract StructTypes {
3939 uint256 id;
4040 uint256 score;
4141 }
42+ Student student; // Inicializar uma struct Student
4243 // Inicialize uma estrutura de dados chamada "student"
4344 // Atribuindo valores a uma estrutura
4445 // Método 1: Criar uma referência struct para storage dentro da função
4546 function initStudent1 () external {
46- // atribuir uma cópia do estudante
47+ Student storage _student = student; // atribuir uma referência à struct student
4748 _student.id = 11 ;
4849 _student.score = 100 ;
4950 }
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ Há quatro maneiras de atribuir valores a uma struct:
107107// Atribuir valores a uma struct
108108// Método 1: Criar uma referência struct storage dentro da função
109109function initStudent1() external {
110- Student storage _student = student; // atribuir uma cópia da struct student
110+ Student storage _student = student; // atribuir uma referência à struct student
111111 _student.id = 11;
112112 _student.score = 100;
113113}
You can’t perform that action at this time.
0 commit comments