It is currently Mon Aug 03, 2020 7:16 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [My mistake] Multidimensional arrays as parameters
PostPosted: Sat Oct 26, 2019 12:20 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 420
Location: Germany
Code:
Procedure Test(Array paramArray(1,1))
    paramArray(0,1) = 10
EndProcedure

Dim testArray(1,1)
Test(testArray())
Debug testArray(0,1)
Quote:
[COMPILER] Line 1: Syntax error.

This should be mentioned in the description of the procedure block.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Last edited by Sicro on Sat Oct 26, 2019 12:58 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Multidimensional arrays are not supported as parameters
PostPosted: Sat Oct 26, 2019 12:27 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1245
Location: right here
You have to specify the number of dimensions, not the size of each dimension:
Code:
Procedure test(Array paramArray(2))     ; 2 dimensions
    paramArray(1,1) = 10
EndProcedure

Dim testArray(1,1)
test(testArray())
Debug testArray(1,1)


Top
 Profile  
Reply with quote  
 Post subject: Re: [My mistake] Multidimensional arrays as parameters
PostPosted: Sat Oct 26, 2019 1:08 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 420
Location: Germany
Thanks. I was confused and too hasty.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: [My mistake] Multidimensional arrays as parameters
PostPosted: Sat Oct 26, 2019 1:39 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1245
Location: right here
No problem. It's only 'documented' :) in the comments of example codes for Dim/Array and Procedure.


Top
 Profile  
Reply with quote  
 Post subject: Re: [My mistake] Multidimensional arrays as parameters
PostPosted: Wed Mar 04, 2020 11:33 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1847
Location: Germany (Saxony, Deutscheinsiedel)
I would close this bug-report. Or do you still have suggestions for better documentation about this topic?

When I look in the PB manual, I can read in the 'Procedure' section, that Arrays can be given a procedure paramenter with the Array keyword. And in the linked 'Array' chapter there is mentioned the correct use including code example.... or?

_________________
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye