Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 386 Bytes

SC2324.md

File metadata and controls

26 lines (16 loc) · 386 Bytes

Pattern: Use of += for numbers

Issue: -

Description

+= on a string variable will concatenate instead of adding numbers.

Example of incorrect code:

var=2 n=3
var+=$n

Example of correct code:

(( var += n ))

var=$((var+n))

Further Reading