Nim lang syntax a = b = c = 7

Viewed 89

How to solve error on syntax var a = b = c = 7 being one RHS value for many LHS just like in C:

 int a,b,c ;
 a = b = c = 7 ;

so on Nim lang:

Error: invalid indentation

Help out, thanks in advance

2 Answers

This is one of the earliest things in the Tutorial:

var a, b, c = 7

xbello answered the question, but if we want to be similar at the C code, we should also answer how to do multiple affectations after declaration :

var a,b,c
(a,b,c) = (7,7,7)
Related