-
Notifications
You must be signed in to change notification settings - Fork 6
VSL By Example
Vihan edited this page Mar 19, 2018
·
3 revisions
Introduction to VSL using examples:
func main() {
print("Hello, World!") // Prints Hello, World!
}
const helloWorld = "Hello, World!"
func main() {
print(helloWorld) // Prints Hello, World!
}
import IO
func main() {
put("Enter your name: ")
let name = read(.line)
print("Hello #{name}")
}
import IO
class Goat {
let name: String
let shoeSize: Int
func greet() {
print("My name is #{self.name} and my shoe size is #{self.shoeSize}")
}
}
func main() {
let goat = Goat(name: "Sir Goat IV", shoeSize: 9)
goat.greet()
}
interface GoatConvertable {
let asGoat: Goat { get }
}
class Goat: GoatConvertable {
let name: String
let shoeSize: Int
let asGoat: Goat { return self }
}
class HornedAnimalWithBeard: GoatConvertable {
let name: String
let shoeSize: Int
let asGoat: Goat { return Goat(name: name, shoeSize: shoeSize) }
}
func sayHi(to goat: Goat) {
}
- Introduction
- Installation
- VSL By Example
- Usage
- WASM (WebAssembly)
- The Basics
- Your First Program
- Syntax
- Concepts
- Modules
- Advanced Details
- Interop
- VSL Development
- Common Errors