mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
docs: improve format in the conditional compilation section (#22248)
This commit is contained in:
parent
ea4bac0340
commit
5f6015fd16
1 changed files with 8 additions and 7 deletions
15
doc/docs.md
15
doc/docs.md
|
@ -6391,28 +6391,29 @@ If a file has an environment-specific suffix, it will only be compiled for that
|
|||
and `file_default.c.v` will be ignored.
|
||||
|
||||
Here is a more complete example:
|
||||
main.v:
|
||||
|
||||
`main.v`:
|
||||
|
||||
```v ignore
|
||||
module main
|
||||
fn main() { println(message) }
|
||||
```
|
||||
|
||||
main_default.c.v:
|
||||
`main_default.c.v`:
|
||||
|
||||
```v ignore
|
||||
module main
|
||||
const message = 'Hello world'
|
||||
```
|
||||
|
||||
main_linux.c.v:
|
||||
`main_linux.c.v`:
|
||||
|
||||
```v ignore
|
||||
module main
|
||||
const message = 'Hello linux'
|
||||
```
|
||||
|
||||
main_windows.c.v:
|
||||
`main_windows.c.v`:
|
||||
|
||||
```v ignore
|
||||
module main
|
||||
|
@ -6421,10 +6422,10 @@ const message = 'Hello windows'
|
|||
|
||||
With the example above:
|
||||
|
||||
- when you compile for windows, you will get 'Hello windows'
|
||||
- when you compile for linux, you will get 'Hello linux'
|
||||
- when you compile for Windows, you will get `Hello windows`
|
||||
- when you compile for Linux, you will get `Hello linux`
|
||||
- when you compile for any other platform, you will get the
|
||||
non specific 'Hello world' message.
|
||||
non specific `Hello world` message.
|
||||
|
||||
- `_d_customflag.v` => will be used *only* if you pass `-d customflag` to V.
|
||||
That corresponds to `$if customflag ? {}`, but for a whole file, not just a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue