How to define variables in carbon language?

how to define variables in carbon language

To define variables in carbon language, use this syntax –

var identifier: < expression | auto > [ = value ];

Code Example

var x: i32 = 42;

Let’s understand this example –

We can also write this code using auto

var x: auto = 42;

auto results in a constant IntLiteral(42) value.