We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

I see that i, and j are set by the input string. I also see that beautiful days is an int and set to zero. where I get lost is the for integer in i...j. int2reverse and reversedNum don't look like they get set to me. Where do they get their values from? I don't understand how the input value of i and j get into the for integer in i..j{}

for item in items {} is how for cycle is intended for Swift. The block {} will be executed items.count times and 'item' variable will assume each value of 'items' per iteration.
In my code I used 'integer' as variable.
According to that, int2reverse is initialized with 'integer' that is an int value equals to 'i' at first iteration, i+1, ... j in the last iteration.

## Beautiful Days at the Movies

You are viewing a single comment's thread. Return to all comments →

Beautiful days using beautiful Swift.....

what happen to i and j? im still learnig swift.

what do you mean ?

I see that i, and j are set by the input string. I also see that beautiful days is an int and set to zero. where I get lost is the for integer in i...j. int2reverse and reversedNum don't look like they get set to me. Where do they get their values from? I don't understand how the input value of i and j get into the

`for integer in i..j{}`

for item in items {} is how for cycle is intended for Swift. The block {} will be executed items.count times and 'item' variable will assume each value of 'items' per iteration. In my code I used 'integer' as variable. According to that, int2reverse is initialized with 'integer' that is an int value equals to 'i' at first iteration, i+1, ... j in the last iteration.

So here does not support Swift 3 yet? I've used componentsSeparated(by:), and get a error :(

unfortunately Swift 3 here is not supported yet.

Nice solution!

What do you think about using tuple here?