mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +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.
|
and `file_default.c.v` will be ignored.
|
||||||
|
|
||||||
Here is a more complete example:
|
Here is a more complete example:
|
||||||
main.v:
|
|
||||||
|
`main.v`:
|
||||||
|
|
||||||
```v ignore
|
```v ignore
|
||||||
module main
|
module main
|
||||||
fn main() { println(message) }
|
fn main() { println(message) }
|
||||||
```
|
```
|
||||||
|
|
||||||
main_default.c.v:
|
`main_default.c.v`:
|
||||||
|
|
||||||
```v ignore
|
```v ignore
|
||||||
module main
|
module main
|
||||||
const message = 'Hello world'
|
const message = 'Hello world'
|
||||||
```
|
```
|
||||||
|
|
||||||
main_linux.c.v:
|
`main_linux.c.v`:
|
||||||
|
|
||||||
```v ignore
|
```v ignore
|
||||||
module main
|
module main
|
||||||
const message = 'Hello linux'
|
const message = 'Hello linux'
|
||||||
```
|
```
|
||||||
|
|
||||||
main_windows.c.v:
|
`main_windows.c.v`:
|
||||||
|
|
||||||
```v ignore
|
```v ignore
|
||||||
module main
|
module main
|
||||||
|
@ -6421,10 +6422,10 @@ const message = 'Hello windows'
|
||||||
|
|
||||||
With the example above:
|
With the example above:
|
||||||
|
|
||||||
- when you compile for windows, you will get 'Hello windows'
|
- when you compile for Windows, you will get `Hello windows`
|
||||||
- when you compile for linux, you will get 'Hello linux'
|
- when you compile for Linux, you will get `Hello linux`
|
||||||
- when you compile for any other platform, you will get the
|
- 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.
|
- `_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
|
That corresponds to `$if customflag ? {}`, but for a whole file, not just a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue