Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
put zeroArgsFn()
|
||||
|
||||
// Function calls can also be made using the following syntax:
|
||||
put the zeroArgsFn
|
||||
|
||||
function zeroArgsFn
|
||||
put "This function was run with zero arguments."
|
||||
return "Return value from zero argument function"
|
||||
end zeroArgsFn
|
||||
15
Task/Call-a-function/SenseTalk/call-a-function-2.sensetalk
Normal file
15
Task/Call-a-function/SenseTalk/call-a-function-2.sensetalk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
put TwoArgFn("variable", (3, 4)) into _
|
||||
|
||||
// Alternatively, the function can be called like so:
|
||||
put the TwoArgFn of "variable", (3, 4)
|
||||
|
||||
// The parameter list is flexible, allowing any amount of variable to be passed in.
|
||||
// These can be accessed with the keyword `the parameterList`
|
||||
// The specified parameters only limits to named parameters
|
||||
get TwoArgFn("variable", (3, 4), "hello")
|
||||
get the TwoArgFn of "variable", (3, 4), "hello"
|
||||
|
||||
function TwoArgFn arg1, arg2
|
||||
put "2 argument function: arg1 = " & arg1 & "; arg2 = " & arg2
|
||||
put "Parameters = " & the parameterList
|
||||
end TwoArgFn
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
get ThreeArgFn("variable", (3, 4))
|
||||
|
||||
function ThreeArgFn arg1, arg2, arg3
|
||||
put "3 argument function: arg1 = " & arg1 & "; arg2 = " & arg2 & "; arg3 = " & arg3
|
||||
end ThreeArgFn
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
get OneArgFn() -- arg1 is 5
|
||||
get OneArgFn(10) -- arg1 is now 10
|
||||
|
||||
function OneArgFn arg1
|
||||
if arg1 is ""
|
||||
set arg1 to 5
|
||||
end if
|
||||
put "One argument function; arg1 = " & arg1
|
||||
end OneArgFn
|
||||
13
Task/Call-a-function/SenseTalk/call-a-function-5.sensetalk
Normal file
13
Task/Call-a-function/SenseTalk/call-a-function-5.sensetalk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
put 3 into a
|
||||
get AddOne(a)
|
||||
put "Value of a = " & a
|
||||
// Value of a = 3
|
||||
|
||||
put 5 into b
|
||||
get AddOne(container b)
|
||||
put "Value of b = " & b
|
||||
// Value of b = 6
|
||||
|
||||
function AddOne n
|
||||
add 1 to n
|
||||
end AddOne
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
CustomHandler 1, 2, 3
|
||||
// Prints: 1 - 2 - 3
|
||||
|
||||
to handle CustomHandler arg1, arg2, arg3
|
||||
put arg1 && "-" && arg2 && "-" && arg3
|
||||
end CustomHandler
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
MyCommand 1, "variable", (4, 5, 6)
|
||||
|
||||
to MyCommand args
|
||||
...
|
||||
end MyCommand
|
||||
11
Task/Call-a-function/SenseTalk/call-a-function-8.sensetalk
Normal file
11
Task/Call-a-function/SenseTalk/call-a-function-8.sensetalk
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
to MyFn args
|
||||
...
|
||||
end MyFn
|
||||
|
||||
function MyFn args
|
||||
...
|
||||
end args
|
||||
|
||||
on MyFn args
|
||||
...
|
||||
end args
|
||||
Loading…
Add table
Add a link
Reference in a new issue