This is a good place to use if expressions:
    
    
    import std/strutils
    
    func hey(phrase: string): string =
      if phrase.strip == "":
        "Fine. Be that way!"
      elif phrase.toUpperAscii == phrase and phrase.toLowerAscii != phrase:
        if phrase.strip.endsWith('?'):
          "Calm down, I know what I'm doing!"
        else:
          "Whoa, chill out!"
      elif phrase.strip.endsWith('?'):
        "Sure."
      else:
        "Whatever."
    
    
    Run

Reply via email to