current position:Home>The error reported by the solidness is as follows!!!!!

The error reported by the solidness is as follows!!!!!

2022-02-04 00:07:47 Q & A of Denglian community

image.png

I don't understand why there are consistent error reports

dynamicString.sol:27:22: DeclarationError: Undeclared identifier. Did you mean "name", "name3" or "nmae2"? return bytes(name2).length; ^---^

Specific code

pragma solidity ^0.4.26;contract DynamicString{    string name3 = " Byte byte ";    string nmae2 = "#$%^&*%%%";    string name = "eleven";  // 0x656c6576656e    function getChineseName() view returns(bytes){        return bytes(name3);    }    function getLength3() view returns(uint){    //  return name.length;        return bytes(name3).length;    }    function getLength2() view returns(uint){    //  return name.length;        return bytes(name2).length;    }    function getLength() view returns(uint){    //  return name.length;        return bytes(name).length;    }    function changeName() view returns(bytes1){    //  return name[0];        return bytes(name)[0];    }    function getName() view returns(bytes){        return bytes(name);    }    function changeName4() {    //  return name[0];        bytes(name)[1] = "Q";    }}



Take the answer 1:

Spelling mistakes ? nmae2 and name2




copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202040007447364.html

Random recommended