0 votes
in Education by (1.7m points)
in Obj-C it was possible to iterate through alphabet with:

for (char x='A'; x<='Z'; x++) {

In Swift this isn't possible. Any idea how I could do this?

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
In Swift, you can iterate chars on a string like this:

Swift 2

for char in "abcdefghijklmnopqrstuvwxyz".characters {



Swift 1.2

for char in "abcdefghijklmnopqrstuvwxyz" {



There might be a better way though.