Type detection: Difference between revisions
→{{header|Icon}}
Line 477:
The type of 'Rosetta' is string
</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}}==
Line 482 ⟶ 514:
This should work with the Unicon compiler, but I currently have only the Arizona Icon compiler to test it with.
See also [[#ObjectIcon|ObjectIcon]] and [[#Goaldi|Goaldi]].
<lang icon>procedure main()
|