Dating agency: Difference between revisions

julia example
m (Broaden examples)
(julia example)
Line 80:
But just between us, only the following ladies are compatible with Willy:
Robin
</pre>
 
=={{header|Julia}}==
{{trans|Python}}
<lang julia>sailors = ["Adrian", "Caspian", "Dune", "Finn", "Fisher", "Heron", "Kai",
"Ray", "Sailor", "Tao"]
 
ladies = ["Ariel", "Bertha", "Blue", "Cali", "Catalina", "Gale", "Hannah",
"Isla", "Marina", "Shelly"]
 
isnicegirl(s) = Int(s[begin]) % 2 == 0
 
islovable(slady, ssailor) = Int(slady[end]) % 2 == Int(ssailor[end]) % 2
 
for lady in ladies
if isnicegirl(lady)
println("Dating service should offer a date with ", lady)
for sailor in sailors
if islovable(lady, sailor)
println(" Sailor ", sailor, " should take an offer to date her.")
end
end
else
println("Dating service should NOT offer a date with ", lady)
end
end
</lang>{{out}}
<pre>
Dating service should NOT offer a date with Ariel
Dating service should offer a date with Bertha
Sailor Dune should take an offer to date her.
Sailor Kai should take an offer to date her.
Sailor Ray should take an offer to date her.
Sailor Tao should take an offer to date her.
Dating service should offer a date with Blue
Sailor Dune should take an offer to date her.
Sailor Kai should take an offer to date her.
Sailor Ray should take an offer to date her.
Sailor Tao should take an offer to date her.
Dating service should NOT offer a date with Cali
Dating service should NOT offer a date with Catalina
Dating service should NOT offer a date with Gale
Dating service should offer a date with Hannah
Sailor Adrian should take an offer to date her.
Sailor Caspian should take an offer to date her.
Sailor Finn should take an offer to date her.
Sailor Fisher should take an offer to date her.
Sailor Heron should take an offer to date her.
Sailor Sailor should take an offer to date her.
Dating service should NOT offer a date with Isla
Dating service should NOT offer a date with Marina
Dating service should NOT offer a date with Shelly
</pre>
 
4,105

edits