diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 63eceba190..9c5c7f5673 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -335,7 +335,7 @@ fn (c mut Checker) assign_expr(assign_expr mut ast.AssignExpr) { scope := c.file.scope.innermost(assign_expr.pos.pos) if v := scope.find_var(it.name) { if !v.is_mut { - c.error('`$it.name` is immutable, declare it with `mut`', assign_expr.pos) + c.error('`$it.name` is immutable, declare it with `var` to assign to it', assign_expr.pos) } } } diff --git a/vlib/v/parser/for.v b/vlib/v/parser/for.v index 9fc87ba1f6..f6ff6f78f4 100644 --- a/vlib/v/parser/for.v +++ b/vlib/v/parser/for.v @@ -24,7 +24,7 @@ fn (var p Parser) for_stmt() ast.Stmt { is_inf: true } } else if p.tok.kind in [.key_mut, .key_var] { - p.error('`mut` is not needed in for loops') + p.error('`var` is not needed in for loops') } else if p.peek_tok.kind in [.decl_assign, .assign, .semicolon] || p.tok.kind == .semicolon { // `for i := 0; i < 10; i++ {` var init := ast.Stmt{}