mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: updateimport ()
and []array
This commit is contained in:
@ -1,13 +1,11 @@
|
||||
module main
|
||||
|
||||
import (
|
||||
cli
|
||||
os
|
||||
)
|
||||
import cli
|
||||
import os
|
||||
|
||||
fn main() {
|
||||
mut cmd := cli.Command{
|
||||
name: 'cli',
|
||||
name: 'cli',
|
||||
description: 'An example of the cli library',
|
||||
version: '1.0.0',
|
||||
parent: 0
|
||||
@ -22,7 +20,7 @@ fn main() {
|
||||
parent: 0
|
||||
}
|
||||
greet_cmd.add_flag(cli.Flag{
|
||||
flag: .string,
|
||||
flag: .string,
|
||||
required: true,
|
||||
name: 'language',
|
||||
abbrev: 'l',
|
||||
|
@ -1,8 +1,6 @@
|
||||
module main
|
||||
|
||||
import (
|
||||
some_module
|
||||
)
|
||||
import some_module
|
||||
|
||||
fn main(){
|
||||
mut sub := some_module.get_subscriber()
|
||||
|
@ -1,8 +1,6 @@
|
||||
module some_module
|
||||
|
||||
import (
|
||||
eventbus
|
||||
)
|
||||
import eventbus
|
||||
|
||||
const (
|
||||
eb = eventbus.new()
|
||||
|
@ -12,8 +12,8 @@ fn expr_to_rev_pol(expr string) ?[]string {
|
||||
if expr == '' {
|
||||
return error('err: empty expression')
|
||||
}
|
||||
mut stack := []string
|
||||
mut rev_pol := []string
|
||||
mut stack := []string{}
|
||||
mut rev_pol := []string{}
|
||||
mut pos := 0
|
||||
for pos<expr.len {
|
||||
mut end_pos := pos
|
||||
|
@ -9,7 +9,7 @@ const (
|
||||
fn main() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.next(MAX) // skip the first
|
||||
mut arr := []int
|
||||
mut arr := []int{}
|
||||
for _ in 0..LEN {
|
||||
arr << rand.next(MAX)
|
||||
}
|
||||
@ -33,7 +33,7 @@ fn quick_sort(arr mut []int, l int, r int) {
|
||||
quick_sort(mut arr, sep+1, r)
|
||||
}
|
||||
|
||||
[inline]
|
||||
[inline]
|
||||
fn swap(arr mut []int, i int, j int) {
|
||||
temp := arr[i]
|
||||
arr[i] = arr[j]
|
||||
|
@ -1,10 +1,8 @@
|
||||
module main
|
||||
|
||||
import (
|
||||
vweb
|
||||
vweb.assets
|
||||
time
|
||||
)
|
||||
import vweb
|
||||
import vweb.assets
|
||||
import time
|
||||
|
||||
const (
|
||||
port = 8081
|
||||
|
@ -22,7 +22,7 @@ fn main() {
|
||||
m[word] = m[word] + 1 // TODO m[key]++
|
||||
}
|
||||
// Sort the keys
|
||||
mut keys := m.keys()
|
||||
mut keys := m.keys()
|
||||
keys.sort()
|
||||
// Print the map
|
||||
for key in keys {
|
||||
@ -33,7 +33,7 @@ fn main() {
|
||||
|
||||
// Creates an array of words from a given string
|
||||
fn extract_words(contents string) []string {
|
||||
mut splitted := []string
|
||||
mut splitted := []string{}
|
||||
for space_splitted in contents.to_lower().split(' ') {
|
||||
if space_splitted.contains('\n') {
|
||||
splitted << space_splitted.split('\n')
|
||||
@ -43,7 +43,7 @@ fn extract_words(contents string) []string {
|
||||
}
|
||||
}
|
||||
|
||||
mut results := []string
|
||||
mut results := []string{}
|
||||
for s in splitted {
|
||||
result := filter_word(s)
|
||||
if result == '' {
|
||||
|
Reference in New Issue
Block a user