Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
on getName(x)
set {firstName, lastName} to {"?", "?"}
try
set firstName to x's firstName
end try
try
set lastName to x's lastName
end try
return firstName & ", " & lastName
end getName

View file

@ -0,0 +1,4 @@
getName({firstName:"John", lastName:"Doe"})
--> Returns: "John, Doe"
getName({lastName:"Doe"})
--> Returns: "?, Doe"

View file

@ -0,0 +1,8 @@
on getName(x) -- x assumed to be a record for this demo.
set x to x & {firstName:"?", lastName:"?"}
return x's firstName & ", " & x's lastName
end getName
getName({lastName:"Doe"})
--> "?, Doe"

View file

@ -0,0 +1,6 @@
on getName from firstName beside lastName
return firstName & ", " & lastName
end getName
getName beside "Doe" from "John"
--> "John, Doe"

View file

@ -0,0 +1,6 @@
on getName given firstName:firstName, lastName:lastName
return firstName & ", " & lastName
end getName
getName given lastName:"Doe", firstName:"John"
--> "John, Doe"

View file

@ -0,0 +1,12 @@
on getName given firstName:firstName, lastName:lastName, comma:comma
if (comma) then
return firstName & ", " & lastName
else
return firstName & space & lastName
end if
end getName
getName given lastName:"Doe", firstName:"John" comma:true -- compiles as: getName with comma given lastName:"Doe", firstName:"John"
--> "John, Doe"
getName without comma given lastName:"Doe", firstName:"John"
--> "John Doe"

View file

@ -0,0 +1,12 @@
use AppleScript version "2.4" -- Mac OS X 10.10 (Yosemite) or later.
on getName under category : "Misc: " given firstName:firstName : "?", lastName:lastName : "?", comma:comma : true
if (comma) then
return category & firstName & ", " & lastName
else
return category & firstName & space & lastName
end if
end getName
getName given lastName:"Doe"
--> "Misc: ?, Doe"