Skip to content

Files

Latest commit

 

History

History
22 lines (15 loc) · 507 Bytes

unnecessary_brace_in_string_interps.md

File metadata and controls

22 lines (15 loc) · 507 Bytes

Pattern: Unnecessary braces in string interpolation

Issue: -

Description

If you're just interpolating a simple identifier, and it's not immediately followed by more alphanumeric text, the {} can and should be omitted.

Example of correct code:

print("Hi, $name!");

Example of incorrect code:

print("Hi, ${name}!");

Further Reading