Create an object/Native demonstration: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
(Dialects of BASIC moved to the BASIC section.)
Line 10: Line 10:
If the language supports '''Magic Methods''', then show how these work.
If the language supports '''Magic Methods''', then show how these work.


=={{header|BASIC256}}==
=={{header|BASIC}}==
==={{header|BASIC256}}===
<syntaxhighlight lang="basic256">map mapa
<syntaxhighlight lang="basic256">map mapa
mapa["A"] = 65
mapa["A"] = 65
Line 27: Line 28:
C
C
67</pre>
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
B
66
C
67</pre>


=={{header|C++}}==
=={{header|C++}}==
Line 194: Line 216:
55
55
["a":1, "b":66]</pre>
["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
B
66
C
67</pre>


=={{header|Go}}==
=={{header|Go}}==