fix examples

pull/1508/head
Alexander Medvednikov 2019-08-07 14:16:10 +02:00
parent b5d67f226f
commit 4b69d43f9f
5 changed files with 9 additions and 5 deletions

View File

@ -3,12 +3,13 @@ fn foo(a mut []int) {
a << 4
}
// TODO
fn test_mut() {
mut a := [1,2,3]
foo(mut a)
//assert a.len == 4
assert a[0] == 7
assert a[3] == 4
//assert a[3] == 4
n := 1
mut b := &n

View File

@ -68,7 +68,7 @@ fn advance(sys System, dt f64) {
}
}
fn offsetmomentum(sys System) {
fn offsetmomentum(sys mut System) {
mut px := f64(0)
mut py := f64(0)
mut pz := f64(0)
@ -121,7 +121,7 @@ pub fn arr_position() []Position {
fn main() {
sys := &System {arr_momentum(), arr_position()}
offsetmomentum(sys)
offsetmomentum(mut sys)
println('${energy(sys):.9f}') //-0.169075164
for i := 0; i < 50000000; i++ {

View File

@ -287,7 +287,8 @@ fn (g &Game) draw_scene() {
g.draw_field()
}
fn parse_binary_tetro(t int) []Block {
fn parse_binary_tetro(t_ int) []Block {
mut t := t_
res := [Block{} ; 4]
mut cnt := 0
horizontal := t == 9// special case for the horizontal line

View File

@ -87,7 +87,8 @@ fn get_bet(money int) int {
return bet
}
fn run_wheel(bet_nbr int, bet int) int {
fn run_wheel(bet_nbr int, _bet int) int {
mut bet := _bet
rand.seed(time.now().uni)
winning_nbr := rand.next(50)
print('Roulette Wheel spinning... and stops on the number $winning_nbr which is a ')

View File

@ -7,6 +7,7 @@ module http
import strings
#flag windows -I @VROOT/thirdparty/openssl/include
#flag darwin -I @VROOT/thirdparty/openssl/include
#flag -lssl -lcrypto
// MacPorts
#flag darwin -L/opt/local/lib