2

I've been looking around, and I can't find a way to create an array like this:

var array:[Int] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0..

without typing a hundred zeros and commas. Is there a simple way to do this? Thanks for your time.

1
  • you can use for loop to add zeros to nsmutablearray! Commented Nov 8, 2014 at 4:14

1 Answer 1

2

What about

var array = [Int](count: 100, repeatedValue: 0)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.