swift - Is it best practice to explicitly declare variable types on declaration? -


i new swift language, trying develop healthy programming habits while coding.

is best practice explicitly declare variable types on declaration? example:

var str:string = "likethis" 

or acceptable:

var str= "likethis" 

as know, either option acceptable. however, standard practice have seen not declare variable types unless necessary, rationale these extraneous tokens reduce readability.

here, unnecessary because compiler infer variable type. ray wenderlich's swift style guide agrees.


Popular posts from this blog