Hash from two arrays: Difference between revisions
m
no edit summary
No edit summary |
mNo edit summary |
||
Line 947:
a = new dict[["a", "b", "c"], [1, 2, 3]]
</syntaxhighlight>
=={{header|FutureBasic}}==▼
<syntaxhighlight lang="futurebasic">▼
include "NSLog.incl"▼
void local fn DoIt▼
CFArrayRef keys = @[@"Key1",@"Key2",@"Key3",@"Key4"]▼
CFArrayRef values = @[@"One",@"Two",@"Three",@"O'Leary"]▼
CFDictionaryRef dict = fn DictionaryWithObjectsForKeys( values, keys )▼
NSLog(@"%@",dict)▼
end fn▼
fn DoIt▼
HandleEvents▼
</syntaxhighlight>▼
{{out}}▼
<pre>▼
{▼
Key1 = One;▼
Key2 = Two;▼
Key3 = Three;▼
Key4 = "O'Leary";▼
}▼
</pre>▼
=={{header|Gambas}}==
Line 973 ⟶ 999:
4 = Four
5 = Five
▲</pre>
▲=={{header|FutureBasic}}==
▲<syntaxhighlight lang="futurebasic">
▲include "NSLog.incl"
▲void local fn DoIt
▲ CFArrayRef keys = @[@"Key1",@"Key2",@"Key3",@"Key4"]
▲ CFArrayRef values = @[@"One",@"Two",@"Three",@"O'Leary"]
▲ CFDictionaryRef dict = fn DictionaryWithObjectsForKeys( values, keys )
▲ NSLog(@"%@",dict)
▲end fn
▲fn DoIt
▲HandleEvents
▲</syntaxhighlight>
▲{{out}}
▲<pre>
▲{
▲ Key1 = One;
▲ Key2 = Two;
▲ Key3 = Three;
▲ Key4 = "O'Leary";
▲}
</pre>
|