v-community / v_by_example Goto Github PK
View Code? Open in Web Editor NEWLearn V by Example
Home Page: https://v-community.gitbook.io/v-by-example/
License: MIT License
Learn V by Example
Home Page: https://v-community.gitbook.io/v-by-example/
License: MIT License
translate readme and contributing guide to german
This should include:
@nedpals perhaps you could help us with this one?
ps: This is a suggestion for an advanced example in V by example.
I think the code inside hello_world.v
is a bit complex there. because the name is hello world
.
I think we can make this simpler by changing some code. 🤔
struct
might be better to have its own examplevariables
there.comments
and print
stuff there.Not all people who want to learn V are people who do not have prior programming skills. Maybe they are new to programming. We don't know, but it would be better to start with something simple. So everyone can learn easily. 😊 ✌️
V by Example
is already doing a good job in terms of contributions, but we still need more maintainers to keep building this project. Please reach out to us in this issue if you're interested in learning the V language and contributing to this repository.
Besides collaborating in the examples, you can also become an official translator maintainer in your native language. We haven't started translating this repository to different languages, but we're discussing this idea in this issue and we are happy to start doing that with your help.
In one of my next PRs, I will be updating the repo structure again so that it will look more clean and easy to browse.
-- main repo
- examples/
- code/
- exercises/
- pdf/
- README.md
- CONTRIBUTING.md
- CODE_OF_CONDUCT.md
- .gitignore
- LICENSE.md
- `.plan` files
Suggestions are welcome!
The current code is:
tom_age := 20
ashia_age := 38
if tom_age < ashia_age {
if tom_age < 18 {
println('tom_age < 18 and younger than Ashia.')
} else {
println('tom_age > 18 and older than Ashia.')
}
} else {
println('$tom_age == $ashia_age')
println('Tom and Ashia have the same age.')
}
// Prints out:
// tom_age > 18 and older than Ashia.
This is not true: Tom is younger than Ashia.
A correct nested-if statement could be:
tom_age := 20
ashia_age := 38
if tom_age < ashia_age {
if tom_age < 18 {
println('tom_age < 18 and younger than Ashia.')
} else {
println('tom_age >= 18 and younger than Ashia.')
}
} else if tom_age > ashia_age {
println('$tom_age > $ashia_age')
} else {
println('$tom_age == $ashia_age')
}
This prints out:
// tom_age >= 18 and younger than Ashia.
CHANGELOG.md
I'd consider using Rubygems.org
pattern: https://guides.rubygems.org/patterns/#semantic-versioning. A release can contain 1 or more PRs depending on the amount of work required to satisfy the responsibility.
We need to have a better README that should contain:
Thoughts on new items?
I plan on upgrading the repo structure so people can browse easily.
- src/
- chapter/
- README (the explanation of the example)
-code/
-sol/ (solution for the exercise given)
-src/
-chapter/
-README (the explanation of the example)
- code files with solutions (.v)
Any suggestions or ideas are welcome!
Due to this commit
vlang/v@5df5f97
Now we can create an empty array without having to declare the string after it. Please update the Array
This issue discusses the items that we want to work in November.
Please comment below with suggestions.
ps: Please check our october.plan out to see what we've done so far and get some inspiration.
On order to have better overview what is missing, it would be good to have a up-to-date version of the .plan
file.
I am thinking of using Gitbook for V by Examples project because they would be best for browsing online. What you guys think about it?
Translate the Keywords
section to german
add translation for the sections on comments
and hello-world
len is not a method, it's a field in array struct
the code for array struct is:
struct array {
pub:
// Using a void pointer allows to implement arrays without generics and without generating
// extra code for every type.
data voidptr
len int
cap int
element_size int
}
This issue discusses how we should structure the translation for different languages.
V by Example should be available in different languages to attract more people.
Translate the section for primitives to german
The code
mut factorial := 1
mut counter := 1
for i := 0; i < 5; i++ {
factorial=factorial*counter
if i == 6 {
print(factorial)
continue
}
println(i)
}
does not update counter, so factorial is not increased; also i never reaches 6.
The following code:
mut factorial := 1
mut counter := 1
for counter = 1; counter < 6; counter++ {
factorial=factorial * counter
if counter == 5 {
print(factorial)
continue
}
println(counter)
}
produces the desired output:
/*
1
2
3
4
120
*/
Notice that Typo CI check every commit... not every PR
so we need to work directly on base repo instead of the forked repo to get the advantage of Typo CI
OMG ... why did I just realize this ??? 😄
I don’t know if I should make a pull request for this issue:
in many cases in code snippets shown main() is not needed and could be left out, giving a somewhat nicer experience to novel users. On the other hand: in struct.md: the code example with struct User doesn’t run as shown: the code should be in a fn main() {}
I would like to know your opinion on this.
Thanks
We can use V syntax highlighting here in the fenced markdown code parts.
Update example files to have V highlighting instead of Go.
arrays/functions.md:
The example
mut names := ['Samuel', 'John', 'Peter']
names.insert(2, 'Tom')
println(names)
should (temporarily) be removed because it gives an error both on Windows and Linux
// names.insert(2, 'Tom') // Nov 16: error in Windows and Linux
(see mut_arrays.v)
/tmp/v/main.tmp.c: In function ‘main__main’:
/tmp/v/main.tmp.c:3277:38: error: lvalue required as unary ‘&’ operand
array_insert (& /* ? */ names , 2 ,& /112 e="void" g="string" */ tos3("Tom") ) ...
(Use v -g
to print the entire error message)
V error: C error. This should never happen.
If ok, I can do a pull request for this issue.
As an improvement special terms in each file could link to other sections that could explain further or provide more explanation (mut
links to mutable, etc.)
@donnisnoni95 came up with the idea and we both think this should be discussed. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.