mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added documentation and one last test for struct creation inline
This commit is contained in:
@@ -317,7 +317,8 @@ by `msg.data`.
|
||||
Can state variables be initialized in-line?
|
||||
===========================================
|
||||
|
||||
Yes, this is possible for most types (even for structs), but not for arrays.
|
||||
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. Futhermore, multi dimensional arrays cannot be declared inline.
|
||||
|
||||
Examples::
|
||||
|
||||
@@ -325,6 +326,7 @@ Examples::
|
||||
struct S { uint a; uint b; }
|
||||
S public x = S(1, 2);
|
||||
string name = "Ada";
|
||||
string[4] memory AdaArr = ["This", "is", "an", "array"];
|
||||
}
|
||||
contract D {
|
||||
C c = new C();
|
||||
|
||||
Reference in New Issue
Block a user