+ 1
Why doesn't this work in Swift?
Here's the code: var â = 56 print(â) Why doesn't this work even though Swift supports unicode characters? According to me, I haven't violated any variable-naming rules.
2 RĂ©ponses
+ 11
https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID412
Under "Identifiers":
"...Identifiers begin with an uppercase or lowercase letter A through Z, an underscore (_), a noncombining alphanumeric Unicode character in the Basic Multilingual Plane, or a character outside the Basic Multilingual Plane that isnât in a Private Use Area. After the first character, digits and combining Unicode characters are also allowed... "
The hollow star you used, if I'm not mistaken, is U+2606. This appears to lie outside the accepted range of unicode starting U+20xx to U+27xx.
identifier-head â U+2070âU+20CF, U+2100âU+218F, U+2460âU+24FF, or U+2776âU+2793
+ 1
Hatsy Rei Thank you very much.