ISBN13 check digit: Difference between revisions

Line 209:
}</lang>
 
{{works with|langur|0.79.0}}
In this example, we set a for loop value as it progresses.
<lang langur>val .isbn13checkdigit = f(var .s) {
Line 215:
var .alt = true
matching(re/^[0-9]{13}$/, .s) and
for[=0] .d in maps2n(f .c-'0', s2cp .s) { _for += if(.altnot=not .alt: .d x 3; .d) } remdiv 10 == 0
}
 
1,007

edits