Can't find "Label" anywhere

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by julianbury.

I power-searched the whole C:\Program Files\PureBasic folder and cannot find a single reference to the word "Label".
Obviously, this is the wrong word. What is the right word?


^00^
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by julianbury

I power-searched the whole C:\Program Files\PureBasic folder and cannot find a single reference to the word "Label".
The word label is in the reference manual at both places you would expect: Gosub and Goto (Goto is in the "Other" section).

There is no keyword or command called "Label" though. To write a label in your code you simply write some text and put a colon after it:

Code: Select all

OpenConsole()
Goto hereismylabel
PrintN("Never see me")
hereismylabel:
PrintN("Press return to exit")
Input()
CloseConsole()
End

--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.51, external editor)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Hi !
A label is a kind of tag which shows you a certain line in your sourcecode where you can jump to.
Look at the following sourcecode and you will understand how to use it. The labels are "label1:" and "smoke:". The ":" identifies it as label.
Please note: In modern und good programming (languages) you really don´t need it (usually).

MFG
WolfgangS

Code: Select all

OpenConsole()  PrintN("Test 1")
  Goto label1:
  PrintN("Test 2")
label1:
  PrintN("Test 3")
  Goto smoke:
  PrintN("Test 4")
smoke:
  PrintN("Test 5")
  Delay(5000)
End

Doh, tinman was 4 minutes faster ...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by julianbury.

Thank you for that.

I should have said "LabelGadget" for displaying information in a window :)

Sorry for the misunderstanding.

Julian


^00^
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

I guess what you search is a TextGadget()

Timo

-------------------------------
http://freak.coolfreepages.com/
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by julianbury.

I was just going to update my last input to say I had just spotted TextGadget() :)

You were quick off the mark! :D


Julian ^00^
Post Reply