# max(x-y,0) is loop-computable [closed]

I use the programming language Loop: http://en.wikipedia.org/wiki/LOOP_%28programming_language%29

I know that the every primitve recursive function is loop computable and vice versa but I would like to find an algorith for max(x-y,0)

z=Val(x)
loop y times {
z=Dec(z)
}

This programm should calculate x-y, but how can I transform the code to get max(x-y,0)

-
LOOP is not turing complete so don't think you'll be able to translate all algorithms –  ratchet freak Mar 20 at 11:04
Yes I know, but I know that the function max(x-y,0) is a primitive recursive function so it must be loop-computable –  Voyage Mar 20 at 11:11
Please read the Wikipedia article carefully ... "If x has the value zero, then P is not executed inside the LOOP statement. This allows for branches in LOOP programs, where the conditional execution of a partial program depends on whether a variable has value zero or one." –  rwong Mar 20 at 11:41
And also "Negative numbers aren't allowed, and are replaced by zeros." –  rwong Mar 20 at 11:41
Thanks, therefore I am done right? –  Voyage Mar 20 at 11:55

## closed as not a real question by jk., Martijn Pieters, Kilian Foth, Jim G., MadKeithVMar 20 at 14:29

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.