Type detection: Difference between revisions
Content added Content deleted
Line 477: | Line 477: | ||
The type of 'Rosetta' is string |
The type of 'Rosetta' is string |
||
</pre> |
</pre> |
||
=={{header|Goaldi}}== |
|||
{{trans|Icon}} |
|||
<lang goaldi>procedure main() { |
|||
print_text("This\nis a\ntext.\n") |
|||
print_text(file("type_detection-goaldi.gd")) |
|||
} |
|||
procedure print_text(source) { |
|||
case type(source) of { |
|||
string : writes(source) |
|||
file : while write(read(source)) |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
$ goaldi type_detection-goaldi.gd |
|||
<pre>This |
|||
is a |
|||
text. |
|||
procedure main() { |
|||
print_text("This\nis a\ntext.\n") |
|||
print_text(file("type_detection-goaldi.gd")) |
|||
} |
|||
procedure print_text(source) { |
|||
case type(source) of { |
|||
string : writes(source) |
|||
file : while write(read(source)) |
|||
} |
|||
}</pre> |
|||
=={{header|Icon}}== |
=={{header|Icon}}== |
||
Line 482: | Line 514: | ||
This should work with the Unicon compiler, but I currently have only the Arizona Icon compiler to test it with. |
This should work with the Unicon compiler, but I currently have only the Arizona Icon compiler to test it with. |
||
See also [[#ObjectIcon|ObjectIcon]]. |
See also [[#ObjectIcon|ObjectIcon]] and [[#Goaldi|Goaldi]]. |
||
<lang icon>procedure main() |
<lang icon>procedure main() |