docs: more styling fixes
							parent
							
								
									0a89aa0044
								
							
						
					
					
						commit
						fd71093a28
					
				
							
								
								
									
										26
									
								
								doc/docs.md
								
								
								
								
							
							
						
						
									
										26
									
								
								doc/docs.md
								
								
								
								
							|  | @ -18,12 +18,12 @@ you can do in V. | ||||||
| 
 | 
 | ||||||
| <table> | <table> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td><a href='#hello-world'>1. Hello world</a></td> | 		<td width=16%><a href='#hello-world'>1. Hello world</a></td> | ||||||
| 		<td><a href='#comments'>2. Comments</a></td> | 		<td width=16%><a href='#comments'>2. Comments</a></td> | ||||||
| 		<td><a href='#functions'>3. Functions</a></td> | 		<td width=16%><a href='#functions'>3. Functions</a></td> | ||||||
| 		<td><a href='#constants--variables'>4. Variables</a></td> | 		<td width=16%><a href='#variables'>4. Variables</a></td> | ||||||
| 		<td><a href='#primitive-types'>5. Primitive types</a></td> | 		<td width=16%><a href='#primitive-types'>5. Primitive types</a></td> | ||||||
| 		<td><a href='#strings'>6. Strings</a></td> | 		<td width=16%><a href='#strings'>6. Strings</a></td> | ||||||
| 		</tr> | 		</tr> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td><a href='#imports'>7. Imports</a></td> | 		<td><a href='#imports'>7. Imports</a></td> | ||||||
|  | @ -39,7 +39,7 @@ you can do in V. | ||||||
| 		<td><a href='#access-modifiers'>Access modifiers</a></td> | 		<td><a href='#access-modifiers'>Access modifiers</a></td> | ||||||
| 		<td><a href='#methods'>Methods</a></td> | 		<td><a href='#methods'>Methods</a></td> | ||||||
| 		<td><a href='#pure-functions-by-default'>Pure functions by default</a></td> | 		<td><a href='#pure-functions-by-default'>Pure functions by default</a></td> | ||||||
| 		<td><a href='#anonymous--high-order-functions'>Anonymous & high order functions</a></td> | 		<td><a href='#anonymous--high-order-functions'>Anonymous & high order fns</a></td> | ||||||
| 		</tr> | 		</tr> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td><a href='#references'>References</a></td> | 		<td><a href='#references'>References</a></td> | ||||||
|  | @ -51,7 +51,7 @@ you can do in V. | ||||||
| 		</tr> | 		</tr> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td><a href='#sum-types'>Sum types</a></td> | 		<td><a href='#sum-types'>Sum types</a></td> | ||||||
| 		<td><a href='#optionresult-types-and-error-handtdng'>Option/Result & error handling</a></td> | 		<td><a href='#optionresult-types-and-error-handling'>Option/Result & error handling</a></td> | ||||||
| 		<td><a href='#generics'>Generics</a></td> | 		<td><a href='#generics'>Generics</a></td> | ||||||
| 		<td><a href='#concurrency'>Concurrency</a></td> | 		<td><a href='#concurrency'>Concurrency</a></td> | ||||||
| 		<td><a href='#decoding-json'>Decoding JSON</a></td> | 		<td><a href='#decoding-json'>Decoding JSON</a></td> | ||||||
|  | @ -177,7 +177,7 @@ Like constants and types, functions are private (not exported) by default. | ||||||
| To allow other modules to use them, prepend `pub`. The same applies | To allow other modules to use them, prepend `pub`. The same applies | ||||||
| to constants and types. | to constants and types. | ||||||
| 
 | 
 | ||||||
| ## Constants & variables | ## Variables | ||||||
| 
 | 
 | ||||||
| ```v | ```v | ||||||
| name := 'Bob' | name := 'Bob' | ||||||
|  | @ -200,6 +200,8 @@ type `T`. | ||||||
| Unlike most other languages, V only allows defining variables in functions. | Unlike most other languages, V only allows defining variables in functions. | ||||||
| Global (module level) variables are not allowed. There's no global state in V. | Global (module level) variables are not allowed. There's no global state in V. | ||||||
| 
 | 
 | ||||||
|  | <p> </p> | ||||||
|  | 
 | ||||||
| ```v | ```v | ||||||
| mut age := 20 | mut age := 20 | ||||||
| println(age) | println(age) | ||||||
|  | @ -215,6 +217,8 @@ Try compiling the program above after removing `mut` from the first line. | ||||||
| Note the (important) difference between `:=` and `=` | Note the (important) difference between `:=` and `=` | ||||||
| `:=` is used for declaring and initializing, `=` is used for assigning. | `:=` is used for declaring and initializing, `=` is used for assigning. | ||||||
| 
 | 
 | ||||||
|  | <p> </p> | ||||||
|  | 
 | ||||||
| ```v | ```v | ||||||
| fn main() { | fn main() { | ||||||
|     age = 21 |     age = 21 | ||||||
|  | @ -224,6 +228,8 @@ fn main() { | ||||||
| This code will not compile, because the variable `age` is not declared. | This code will not compile, because the variable `age` is not declared. | ||||||
| All variables need to be declared in V. | All variables need to be declared in V. | ||||||
| 
 | 
 | ||||||
|  | <p> </p> | ||||||
|  | 
 | ||||||
| ```v | ```v | ||||||
| fn main() { | fn main() { | ||||||
|     age := 21 |     age := 21 | ||||||
|  | @ -233,6 +239,8 @@ fn main() { | ||||||
| In development mode the compiler will warn you that you haven't used the variable (you'll get an "unused variable" warning). | In development mode the compiler will warn you that you haven't used the variable (you'll get an "unused variable" warning). | ||||||
| In production mode (enabled by passing the `-prod` flag to v – `v -prod foo.v`) it will not compile at all (like in Go). | In production mode (enabled by passing the `-prod` flag to v – `v -prod foo.v`) it will not compile at all (like in Go). | ||||||
| 
 | 
 | ||||||
|  | <p> </p> | ||||||
|  | 
 | ||||||
| ```v | ```v | ||||||
| fn main() { | fn main() { | ||||||
|     a := 10 |     a := 10 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue