checkpoint 2: print numbers of the array

그루두·2024년 4월 11일
0

100 days of SwiftUI

목록 보기
6/108

checkpoint 2
https://www.hackingwithswift.com/quick-start/beginners/checkpoint-2

목표

This time the challenge is to create an array of strings, then write some code that prints the number of items in the array and also the number of unique items in the array.

해결

var animals = ["cat", "dog", "elephant", "koala", "tiger", "lion", "lion"]
var animalsSet = Set(animals)

print(animals.count)
print(animalsSet.count)

코드 파일
https://github.com/soaringwave/Ios-studying/blob/main/printNumberOfArray.playground/Contents.swift

profile
계속 해보자

0개의 댓글

관련 채용 정보