Jump to content

Call a function: Difference between revisions

(Add assembly arm Raspberry)
Line 1,543:
 
=={{header|I}}==
<lang i>//The type of the function argument determines whether or not the value is passed by reference or not.
<lang i>software {
//Eg. numbers are passed by value and lists/arrays are passed by reference.
var line = read() //Calling a function with no arguments and getting a return value.
 
var t = text(10) //Calling a function with fixed arguments.
<lang i>software {
print(1,2,3,4,5,6,7,8,9,0,line,t) //Calling a variadic function.
var line = readprint() //Calling a function with no arguments and getting a return value.
}</lang>
varprint("Input ta = text(10number!") //Calling a function with fixed arguments.
print(1,2,3,4,5,6,7,8,9,0,line,t) //Calling a variadic function with variable arguments.
input = read() //Obtaining the return value of a function.
myprint = print
myprint("It was: ", input) //Calling first class functions, the same as calling ordinary functions.
//The only distinction that can be made between two functions is if they are 'real' or not.
if type(myprint) = concept
print("myprint is a not a real function")
else if type(myprint) = function
print("myprint is a real function")
end
 
//Partial functions can be created with static parts.
DebugPrint = print["[DEBUG] ", text]
DebugPrint("partial function!") //This would output '[DEBUG] partial function!'
 
if type(DebugPrint) = concept
print("DebugPrint is a not a real function")
else if type(DebugPrint) = function
print("DebugPrint is a real function")
end
}
}</lang>
 
=={{header|Icon}} and {{header|Unicon}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.