3 ms·
Wouldn’t that argue in favor of val breakfast: “eggs and bacon” = String and not val breakfast: String = “eggs and bacon”
by htfu 6y ago
Wouldn’t that argue in favor of
val breakfast: “eggs and bacon” = String
and not
val breakfast: String = “eggs and bacon”
- djur 6y agoMy intention was solely to counter the idea that using ":" to mean "is" or "is a" is somehow inconsistent with written English. I don't think it's always necessary or even desirable to match the use of symbols in programming with English orthography, in any case. The use of a declaration with initialization as the example here muddies the water. Whatever syntax you use has to work for uninitialized declaration of variables, function arguments, and structure members: val breakfast: String fun serveBreakfast(breakfast: String) struct MealPlan { breakfast: String } Declaration with initialization just needs to be consistent with these.