Since the strings use are constant, better to define them before the code, it's 
cleaner imho.

You can use the contains proc with sets of letters, like this, instead of your 
loops:
    let shouting = phrase.contains({'A'..'Z'}) and not 
phrase.contains({'a'..'z'}

This part is redundant " elif contains(PossibleQuestion,"?"):" since all you 
care is if the question mark is at the end, so you can just use the endsWith ? 
You can ommit the type declaration here, it gets inferred from the value "var 
qualifier = true" You don't need to specify range to iterate all chars in a 
string, just for i in stringVar. This was the best I could do, solved it 
previously: <https://exercism.org/tracks/nim/exercises/bob/solutions/sgmihai> 
Compare with my solution and see if your logic can be shortened, your code is 
way too convoluted. 

Reply via email to