Questions tagged [keyword]

Keywords are special words used as identifiers by a language. They are reserved words accepted by a compiler or interpreter, and thus should not (or cannot) be used as a variable or function name.

Filter by
Sorted by
Tagged with
1 vote
1 answer
386 views

Are immutable variables part of the contract storage?

Suppose that you define an immutable variable like this: contract Contract { uint256 public immutable foo; uint256 public bar; constructor() { foo = 50; } Will bar be the ...
Paul Razvan Berg's user avatar
1 vote
0 answers
46 views

Why my manually generated mnemonic seed phrase is not recognised by metamask or trust wallet

I created a random entropy using this code func randomNumGenerator() []byte { n := 16 randomByte := make([]byte, n) _, err := rand.Read(randomByte) if err != nil { panic(err) ...
Athul A's user avatar
  • 11
0 votes
1 answer
154 views

Mapping function returning value

Below is the code which I saw on Solidity official site pragma solidity >=0.4.0 <0.9.0; contract MappingExample { mapping(address => uint) public balances; function update(uint ...
Brijesh's user avatar
  • 43
0 votes
1 answer
175 views

Internal function use cases

What is the main purpose / family of use-cases for the existence of internal functions in solidity?
bridgemnc's user avatar
1 vote
0 answers
52 views

What the this keyword means?

im doing the ethernaut course. what does this mean ? I know what for exemple address(this)means, it s the address of the smart contract but like what does it means when the this is alone like this?
disqid's user avatar
  • 13
1 vote
2 answers
237 views

How to send Ethereum to smart contract address without using keyword "payable"?

I have tried to send Ethereum from my wallet to the smart contract address by using the below code: pragma solidity >=0.6.10; contract NoUsePayable { function getBalance() public view returns (...
Kingpant's user avatar
1 vote
1 answer
3k views

What is the difference between the abstract and virtual keywords in Solidity?

Solidity has the keywords abstract and virtual. What is the difference?
Shane Fontaine's user avatar
1 vote
1 answer
1k views

How to set time based function in solidity? [duplicate]

I want to run a function after every 365 days in Solidity. I have tried to use the now keyword, but it is not working (I tried in Remix). How can I get the time?
Himanshu's user avatar
0 votes
1 answer
121 views

Is there an "in" keyword in Solidity similar to Python? [duplicate]

I understand that "in" is a reserved keyword in the Solidity language (for now) but can it be used like the "in" keyword is used in the Python language? That is can it be used to find a specific value ...
aymusbond's user avatar
2 votes
1 answer
232 views

Why does Solidity not use the years keyword?

Solidity has keywords like seconds, minutes, hours, days and weeks that are used to specify units of time. Why do they not have years?
Shane Fontaine's user avatar
30 votes
3 answers
10k views

What is the difference between the constant and immutable keywords in Solidity?

What is the difference between the constant and immutable keywords in Solidity and how do I use them?
Shane Fontaine's user avatar
22 votes
2 answers
15k views

What is the immutable keyword in Solidity?

What is the immutable keyword in Solidity and how do I use it?
Shane Fontaine's user avatar
32 votes
1 answer
32k views

What is the receive keyword in solidity?

Solidity has a receive keyword. What is it and how do I use it?
Shane Fontaine's user avatar
1 vote
1 answer
75 views

How keccak hashing and for loop happening in pure function?

I put a keccak hashing inside pure function, it works and return me the result.It also works in a for loop. I studied that hashing the data and loop consumes consider amount of gas. Do we need to ...
Naveen Kumar's user avatar
51 votes
1 answer
47k views

What are the virtual and override keywords in Solidity?

Solidity 0.6.0 introduced the keywords virtual and override. What do they do?
Shane Fontaine's user avatar
22 votes
1 answer
16k views

Is it possible to perform a try-catch in Solidity?

Does Solidity support try-catch functionality? If so, how does it work? What are the limitations?
Shane Fontaine's user avatar
140 votes
2 answers
62k views

When should I use calldata and when should I use memory?

I have seen people use both memory and calldata keywords when writing Solidity. Specifically, they are used when declaring function parameters that take dynamic types like 'structs' or 'arrays'. When ...
Shane Fontaine's user avatar