Variables: Difference between revisions

→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)"
No edit summary
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 5,298:
Attributes <code>Public</code> or <code>Private</code> can mofidy these scopes.
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="textv (vlang)">name := 'Bob'
age := 20
large_number := i64(9999999999)</syntaxhighlight>
Line 5,311:
 
'''Mutable variables'''
<syntaxhighlight lang="textv (vlang)">mut age := 20
println(age) // 20
age = 21
Line 5,328:
'''Declaration errors'''
In development mode the compiler will warn you that you haven't used the variable (you'll get an "unused variable" warning). In production mode (enabled by passing the -prod flag to v – v -prod foo.v) it will not compile at all (like in Go).
<syntaxhighlight lang="textv (vlang)">fn main() {
a := 10
if true {
451

edits