[swift-users] Why there's no Character literals?

Zhao Xin owenzx at gmail.com
Sun Jul 10 20:40:17 CDT 2016


Of course not. Struct Set is commonly known.

let foo:Set = [1,2,3,4]

let bar:Set<Int> = [1,2,3,4]


If you do not specify them as Sets, foo and bar will be Arrays.

Zhaoxin

On Thu, Jul 7, 2016 at 5:35 PM, 王 黎明 <swift-users at swift.org> wrote:

>
> In Swift, we must specify the type for Character variables(because there’s
> no Character literals):
>
> let eol: Character = “\n”
>
>
> it's not a big problem, but, Is it the unique case that can’t use type
> infer?
>
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160711/ad733784/attachment.html>


More information about the swift-users mailing list