Variable declaration reset: Difference between revisions

→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)"
m (syntax highlighting fixup automation)
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 696:
</pre>
 
=={{header|V (Vlang)}}==
Note firstly that unassigned variables are impossible in Vlang. If a variable is created it must have an explicit value, then it is assigned the default value for its type which in the case of numbers is zero. Fortunately, this doesn't clash with values in the slice in the following program.
<syntaxhighlight lang="v (vlang)">fn main() {
s := [1, 2, 2, 3, 4, 4, 5]
451

edits