user17227456
user17227456

Reputation: 1317

Nim lang syntax a = b = c = 7

I am getting an 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

How can I fix this?

Upvotes: 2

Views: 153

Answers (2)

Dimitri Lesnoff
Dimitri Lesnoff

Reputation: 381

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)

Upvotes: 1

xbello
xbello

Reputation: 7443

This is one of the earliest things in the Tutorial:

var a, b, c = 7

Upvotes: 4

Related Questions