IDE multiline

Just starting out? Need help? Post your questions and find answers here.
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

IDE multiline

Post by michel »

How is the exact syntax to work with?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: IDE multiline

Post by ts-soft »

Here a small example:

Code: Select all

Procedure Test(a, ; first parameter
          b,
          c)      ; last parameter
  
  Debug a
  Debug b
  Debug c
EndProcedure

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "Test",
          #PB_Window_SystemMenu |
          #PB_Window_MinimizeGadget)
          
Test(10, 20,
      30)
      
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

Re: IDE multiline

Post by michel »

Hello,
Thank you for the example, nevertheless when I use this construction:

Code: Select all

query0$ = "Select typ,px,py,d1,d2,d,l,Id,typ from Ofenkonstruktion Where ('" + Str(x) + "'>=x1) And ('" + Str(x) + "'<x2) And" 
      query0$ = query0$ + " Ort='" + var_ort$ + "' And Ofen='" + var_ofen$ + "' order by px;" 
where I want to suppress part of the second line like this:

Code: Select all

query0$ = "Select typ,px,py,d1,d2,d,l,Id,typ from Ofenkonstruktion Where ('" + Str(x) + "'>=x1) And ('" + Str(x) + "'<x2) And",
+ " Ort='" + var_ort$ + "' And Ofen='" + var_ofen$ + "' order by px;"

produces "garbage" error
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: IDE multiline

Post by ts-soft »

Code: Select all

query0$ = "Select typ,px,py,d1,d2,d,l,Id,typ from Ofenkonstruktion Where ('" + Str(x) + "'>=x1) And ('" + Str(x) + "'<x2) And" + 
" Ort='" + var_ort$ + "' And Ofen='" + var_ofen$ + "' order by px;" 
:wink:

Line continuation feature, with the following operands: ',' '|' '+' And Or Xor
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: IDE multiline

Post by Tenaja »

I think it has more to do with the syntax error of a plus sign (+) following a comma (,).
michel
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Feb 19, 2007 5:47 pm
Location: Luxemburg

Re: IDE multiline

Post by michel »

Hello
Thank you ts-soft, it works. The syntax (',' '|' '+' And Or Xor) mad me run into trouble as I thought to use , (for and) to join the lines. I think the exact explanation when to use what has to be given in the future help of V5.1
michel
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: IDE multiline

Post by ts-soft »

You can linebreak after each operants, but not inside a stringliteral!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: IDE multiline

Post by VB6_to_PBx »

i like the new Line continuation option in version 5.10 Beta 1

Code: Select all

;        _____Basic.pb

;        VB6=1033x768   PureBasic=1017x730  -16,-38  for Resizable Window


OpenWindow(0, 0, 0, 1017, 730, "VB6=1033x768   PureBasic=1017x730",
         #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | 
         #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )

Repeat
    Select WaitWindowEvent()
    Case #PB_Event_CloseWindow : End
    EndSelect    
ForEver
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
Post Reply