You can't create a variable named "for". Unless you put backticks (``++`++``) around it.


Since that would be the first step down a slippery slope of hopeless confusion, backticks should be removed from identifier names - whether they're keywords or not - and the identifiers renamed as required.


== Noncompliant Code Example

----
var `for` = 1   // Noncompliant
for (var `in` = 0; `in` < 10 && `for` > 0; `in`++) {  // Noncompliant
  // ...
}

var `x` = "hello"  // Noncompliant; why would you do this?
----


== Compliant Solution

----
var i = a
for (var j=0; j< 10; j++) { 
  // ...
}

var x = "hello"
----


== Exceptions

When Objective-C libraries are used in Swift, backticks may be needed around parameter names which are keywords in Swift but not in Objective C. Therefore this rule ignores backticks around parameter names.


----
var protectionSpace: NSURLProtectionSpace = NSURLProtectionSpace(
  host: host,
  port: port,
  `protocol`: prot,  // Compliant
  realm: nil,
  authenticationMethod: authenticationMethod
);
----



ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
