mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5636 from ethereum/faq-array-literal
DOCS: Remove FAQ item that covers array literals
This commit is contained in:
commit
1c4caaa0a2
@ -16,31 +16,6 @@ Enums are not supported by the ABI, they are just supported by Solidity.
|
|||||||
You have to do the mapping yourself for now, we might provide some help
|
You have to do the mapping yourself for now, we might provide some help
|
||||||
later.
|
later.
|
||||||
|
|
||||||
Can state variables be initialized in-line?
|
|
||||||
===========================================
|
|
||||||
|
|
||||||
Yes, this is possible for all types (even for structs). However, for arrays it
|
|
||||||
should be noted that you must declare them as static memory arrays.
|
|
||||||
|
|
||||||
Examples::
|
|
||||||
|
|
||||||
pragma solidity >=0.4.0 <0.6.0;
|
|
||||||
|
|
||||||
contract C {
|
|
||||||
struct S {
|
|
||||||
uint a;
|
|
||||||
uint b;
|
|
||||||
}
|
|
||||||
|
|
||||||
S public x = S(1, 2);
|
|
||||||
string name = "Ada";
|
|
||||||
string[4] adaArr = ["This", "is", "an", "array"];
|
|
||||||
}
|
|
||||||
|
|
||||||
contract D {
|
|
||||||
C c = new C();
|
|
||||||
}
|
|
||||||
|
|
||||||
How do structs work?
|
How do structs work?
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user