Implicit type conversion: Difference between revisions
Content added Content deleted
m (→{{header|J}}: fix some archaic bits) |
Ectomancer (talk | contribs) |
||
Line 1,494: | Line 1,494: | ||
dict({1: 'one', 'two': (2+3j), ('RC', 3): None}) -> {1: 'one', 'two': (2+3j), ('RC', 3): None} |
dict({1: 'one', 'two': (2+3j), ('RC', 3): None}) -> {1: 'one', 'two': (2+3j), ('RC', 3): None} |
||
</pre> |
</pre> |
||
===alternative=== |
|||
One case of implicit casting and one quasi-case: |
|||
<syntaxhighlight lang="python">>>> 12/3 # Implicit cast from int to float. |
|||
4.0 |
|||
>>> (2+4j)/2 # But no implicit cast for complex parts. |
|||
(1+2j) |
|||
>>> (11.5+12j)/0.5 # Quasi-case, complex parts implicit cast from float to int. |
|||
(23+24j) |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |