Include a file: Difference between revisions

Added Kotlin
No edit summary
(Added Kotlin)
Line 648:
<lang Julia>using MyModule</lang>
will import the module and all of its exported symbols
 
=={{header|Kotlin}}==
The closest thing Kotlin has to an ''#include'' directive is its ''import'' directive. This doesn't import source code as such but makes available names defined in another accessible package as if such names were defined in the current file i.e. the names do not need to be fully qualified except to resolve a name clash.
 
Either a single name or all accessible names in a particular scope (package, class, object etc.) can be imported.
 
For example:
<lang scala>package package1
 
fun f() = println("f called")</lang>
 
We can now import and invoke this from code in the default package as follows:
 
<lang scala>// version 1.1.2
 
import package1.f // import f from package `package1`
 
fun main(args: Array<String>) {
f() // invoke f without qualification
}</lang>
 
{{out}}
<pre>
f called
</pre>
 
=={{header|LabVIEW}}==
9,490

edits