1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

docs: mention v run and v symlink earlier

This commit is contained in:
Delyan Angelov
2020-05-31 08:42:34 +03:00
parent bb9d268bd9
commit b17e10c72e
2 changed files with 40 additions and 5 deletions

View File

@ -91,10 +91,20 @@ fn main() {
println('hello world')
}
```
Save that snippet into a file `hello.v` . Now do: `v run hello.v` .
Functions are declared with `fn`. The return type goes after the function
name. In this case `main` doesn't return anything, so the return type can be
omitted.
(That is assuming you have symlinked your V with `v symlink`, as described here
[Symlinking](https://github.com/vlang/v/blob/master/README.md#symlinking).
If you have not yet, you have to type the path to v/v.exe manually.)
Congratulations - you just wrote your first V program, and executed it!
(You can compile a program without execution, with: `v hello.v`.
See `v help` for all supported commands)
In the above example, you can see that functions are declared with `fn`.
The return type goes after the function name. In this case `main` doesn't
return anything, so the return type can be omitted.
As in many other languages (such as C, Go and Rust), `main` is an entry point.