#Help with program
103 messages · Page 1 of 1 (latest)
pseudo stuff:
x = Readfile(data)
y = save_data(x)
conclusie(rank_buildings(y), gebouw_namen, nums)
this is how you are currently having ur function call acting as
your only supplying the heights paramater but not the second names param
@median wedge
ooh
yep
y = save_data(x) is not possible
i still dont get how to fix tthis
and what ur passing in as arguments
conclusie(rank_buildings(save_data(data)),gebouw_namen,nums)
okay
the error come from call to conclusie
this wont work
func main() {
f(x(), 9)
}
func f(_, _, _ int) {}
func x() (int, int) {
return 0, 0
}
this would
func main() {
f(x())
}
func f(_, _ int) {}
func x() (int, int) {
return 0, 0
}
and where does the 9 go
ah so it seems like it has to have the exact amount of params to put in a multi-return value
so is his only avenue is to call it and put them into seperate variables and then call concluse?
but im still confused on what i did wrong and how i can fix it
var z, x = save_data(Readfile(data))
var g, y = rank_buildings(z, x)
conclusie(g, y, gebouw_namen, nums)
in my testing this would work
(obviously bad code lol)
why bad code?
you cant, x() is single expression, so its treated as single argument
just from f(x(), 9), you cant tell if x return multiple value and f accept three parameters.
cuz variable naming and i broke it up to a point where it didint need to be
var z, x = rank_buildings(save_data(Readfile(data)))
conclusie(z, x, gebouw_namen, nums)
this should work too i think
maybe its because my english is not the best, but i dont get what your saying here
this may be a error seperate from the original bug but uh
oh oh
this works yeah
but how can i make this code better
ReadFile is expecting a filename string
because you're saying its bad code
yeah i fixed that problem
im still a newbie with go too
ooh
yeah my plan was to also split the result of rank_buildings in 2, but i didnt know how
apperantly its just var x,y
i don't think theres really way of getting around it unless u make ur functions specifically have the arguments amount u want.. but i mean just putting the values into varaibles should do the job
yeah
pretty much
np, boku found the issue p much lmao
well, still appreciate it 😉
variadic could work too
whats that?
ahh
this is in javascript
so
i think he means basically
instead of ```go
func conclusie(hoogste_int int, hoogste_string string, names []string, heights []int) {
you do
func conclusie(hoogste_int int, hoogste_string string, other ...string) {
but uh
im not sure how that works
with giving two splices as seperate args
if it like joins them or something
hmm
@runic ingot is this right?
well, i guess he's afk
imma go look into it
again, thanks alot!
np but im am curious how u would do this with the way boku suggested
well, i guess we must wait for a reply ;p
yeah true lol
it is a []int and a []string
so idk how u make a variadic type for both of those
I did get it working with any
but im not sure if youll have type issues in the future
F
