Create an object/Native demonstration: Difference between revisions

Dialects of BASIC moved to the BASIC section.
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
(Dialects of BASIC moved to the BASIC section.)
Line 10:
If the language supports '''Magic Methods''', then show how these work.
 
=={{header|BASIC256BASIC}}==
==={{header|FreeBASICBASIC256}}===
<syntaxhighlight lang="basic256">map mapa
mapa["A"] = 65
Line 27 ⟶ 28:
C
67</pre>
 
==={{header|FreeBASIC}}===
FB doesn't have Dict natively, but we can implement them via Type
<syntaxhighlight lang="freebasic">Type dict
m1 As String*1
m2 As Integer
End Type
 
Dim mapOf(1 To 3) As dict => {("A", 65), ("B", 66), ("C", 67)}
 
For i As Integer = 1 To Ubound(mapOf)
Print mapOf(i).m1
Print mapOf(i).m2
Next i</syntaxhighlight>
{{out}}
<pre>A
65
66
67</pre>
 
=={{header|C++}}==
Line 194 ⟶ 216:
55
["a":1, "b":66]</pre>
 
=={{header|FreeBASIC}}==
FB doesn't have Dict natively, but we can implement them via Type
<syntaxhighlight lang="freebasic">Type dict
m1 As String*1
m2 As Integer
End Type
 
Dim mapOf(1 To 3) As dict => {("A", 65), ("B", 66), ("C", 67)}
 
For i As Integer = 1 To Ubound(mapOf)
Print mapOf(i).m1
Print mapOf(i).m2
Next i</syntaxhighlight>
{{out}}
<pre>A
65
66
67</pre>
 
=={{header|Go}}==
512

edits