September 2019
Intermediate to advanced
816 pages
18h 47m
English
A compound declaration allows us to declare a group of variables of the same type without repeating the type. The type is specified a single time and the variables are demarcated by a comma:
// using explicit typeString pending = "pending", processed = "processed", deleted = "deleted";
Replacing String with var will result in code that doesn't compile:
// Does not compilevar pending = "pending", processed = "processed", deleted = "deleted";
The solution to this problem is to transform the compound declaration into one declaration per single line:
// using var, the inferred type is Stringvar pending = "pending";var processed = "processed";var deleted = "deleted";
So, as a rule of thumb, LVTI cannot ...
Read now
Unlock full access