Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small typo in lesson 3 Chapter 12 French Version #35

Open
0xAurelou opened this issue Apr 14, 2022 · 0 comments
Open

Small typo in lesson 3 Chapter 12 French Version #35

0xAurelou opened this issue Apr 14, 2022 · 0 comments

Comments

@0xAurelou
Copy link

function getEvens() pure external returns(uint[]) {
  uint[] memory evens = new uint[](5);
  // On suit l'index du nouveau tableau
  uint counter = 0;
  // On itère de 1 à 19 avec une boucle `for` :
  for (uint i = 1; i <= 10; i++) {
    // Si `i` est pair...
    if (i % 2 == 0) {
      // On l'ajoute au tableau
      evens[counter] = i;
      // On incrémente le `counter` de 1 :
      counter++;
    }
  }
  return evens;
}

but need to be :

function getEvens() pure external returns(uint[]) {
  uint[] memory evens = new uint[](5);
  // On suit l'index du nouveau tableau
  uint counter = 0;
  // On itère de 1 à 10 avec une boucle `for` :
  for (uint i = 1; i <= 10; i++) {
    // Si `i` est pair...
    if (i % 2 == 0) {
      // On l'ajoute au tableau
      evens[counter] = i;
      // On incrémente le `counter` de 1 :
      counter++;
    }
  }
  return evens;
}

Mistake was 19 instead of 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant