RosettaCodeData/Task/Named-parameters/Icon/named-parameters.icon
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

20 lines
651 B
Text

procedure main()
testproc("x:=",1,"y:=",2,"z:=",3)
testproc("x:=",3,"y:=",1,"z:=",2)
testproc("z:=",4,"x:=",2,"y:=",3)
testproc("i:=",1,"y:=",2,"z:=",3)
end
procedure testproc(A[]) #: demo to test named parameters
write("Calling testproc")
while a := get(A) do # implement named parameters here
(( a ? (v := =!["x","y","z"], =":=") | # valid parameter name?
stop("No parameter ",a)) & # . . no
((variable(a[1:-2]) := get(A)) | # assign
runerr(205,a))) # . . problem
write(" x:=",x)
write(" y:=",y)
write(" z:=",z)
end