Compound data type: Difference between revisions

no edit summary
(→‎{{header|Diego}}: Added Diego entry)
No edit summary
Line 2,677:
End Sub
End Structure</lang>
 
=={{header|Vlang}}==
<lang vlang>struct Point {
x int
y int
}
 
// main() declaration can be skipped in one file programs
 
mut p := Point{
x: 10
y: 20
}
 
// struct fields are accessed using a dot
 
println("Value of p.x is: $p.x")
println("Show the struct:\n $p")
 
// alternative literal syntax can be used for structs with 3 fields or fewer
 
p = Point{30, 40}
assert p.x == 30
println("Show the struct again after change:\n $p")
</lang>
{{out}}
<pre>
Value of p.x is: 10
Show the struct:
Point{
x: 10
y: 20
}
Show the struct again after change:
Point{
x: 30
y: 40
}
</pre>
 
=={{header|Wren}}==
291

edits