mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-10 17:09:59 +00:00
Converted var to const if there is no mutation in var.
This is checked from compiler version 0.12.0-dev.1664
This commit is contained in:
@@ -83,19 +83,19 @@ const DuctError = error{UnmatchedDiameters};
|
||||
|
||||
pub fn main() void {
|
||||
// This is a real duck!
|
||||
var ducky1 = Duck{
|
||||
const ducky1 = Duck{
|
||||
.eggs = 0,
|
||||
.loudness = 3,
|
||||
};
|
||||
|
||||
// This is not a real duck, but it has quack() and waddle()
|
||||
// abilities, so it's still a "duck".
|
||||
var ducky2 = RubberDuck{
|
||||
const ducky2 = RubberDuck{
|
||||
.in_bath = false,
|
||||
};
|
||||
|
||||
// This is not even remotely a duck.
|
||||
var ducky3 = Duct{
|
||||
const ducky3 = Duct{
|
||||
.diameter = 17,
|
||||
.length = 165,
|
||||
.galvanized = true,
|
||||
|
||||
Reference in New Issue
Block a user