I have this error:

Expected primary expression.

This is the code :

pragma solidity ^0.4.17; 

contract Adoption {

address[16] public adopters;

// Adopter un animal
function adopt(uint petId) public returns (uint) { 
  require(petId >= 0 &amp,&amp; petId <= 15); 
  adopters[petId] = msg.sender; 
  return petId;

// La liste des propriétaires
function getAdopters() public view returns (address[16]) {
  return adopters;


Your syntax error can easily be fixed by just changing &amp,&amp; to &&.

However, this will then give you a call stack size error, since you cannot return an object as large as your adopters array. You should ideally have a getAdopters(uint256 id) function that returns just one adopter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.