Variables: Difference between revisions

No edit summary
Line 1,979:
 
=={{header|Pony}}==
<lang Pony>var counter: I32 = 10 // mutable variable 'counter' with value 10
<lang Pony>
let temp: F64 = 36.6 // immutable variable 'temp'
</lang>
let str: String // immutable variable 'str' with no initial value
str = "i am a string" // variables must be initialized before use
let another_str = "i am another string" // type of variable 'another_str' infered from assigned value</lang>
 
Destructive read
<lang Pony>var x: I32 = 10
var y: I32 = x = 20
try
Fact(x == 20) // x gets the new value of 20
Fact(y == 10) // y gets the old value of x which is 10
end</lang>
 
=={{header|PureBasic}}==
Anonymous user