ISBN13 check digit: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 209: | Line 209: | ||
}</lang> |
}</lang> |
||
{{works with|langur|0. |
{{works with|langur|0.9.0}} |
||
In this example, we set a for loop value as it progresses. |
In this example, we set a for loop value as it progresses. |
||
<lang langur>val .isbn13checkdigit = f(var .s) { |
<lang langur>val .isbn13checkdigit = f(var .s) { |
||
Line 215: | Line 215: | ||
var .alt = true |
var .alt = true |
||
matching(re/^[0-9]{13}$/, .s) and |
matching(re/^[0-9]{13}$/, .s) and |
||
for[=0] .d in |
for[=0] .d in s2n(.s) { _for += if(not= .alt: .d x 3; .d) } div 10 |
||
} |
} |
||