Jump to content


Photo

break; Not working


  • Please log in to reply
4 replies to this topic

#1 Piwi

Piwi

    GMC Member

  • New Member
  • 5 posts
  • Version:GM8

Posted 02 May 2012 - 08:14 PM

Using the break statement (like Delphis <Exit>) to exit a script, dosn't work anymore. I got an Compile error.... Break used without content.

Like calling a testscript.

if (var1=1) and (var2=0)
{
break;
}

if (....)
{
break;
}

...
...
other scriptcode...


Another way to solve this problem ?

regards

Piwi
  • 0

#2 GStick

GStick

    All Secrets Exposed

  • GMC Member
  • 1576 posts
  • Version:GM:Studio

Posted 02 May 2012 - 08:45 PM

break exits from loops and switch-case. exit exits a script.

edit: Though, I suppose break should probably work...

Edited by GStick, 02 May 2012 - 08:46 PM.

  • 0

#3 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 461 posts
  • Version:GM8.1

Posted 02 May 2012 - 08:46 PM

If you want to end a script use 'exit;' not 'break'

'break' is for pausing loop functions.
  • 0

#4 Piwi

Piwi

    GMC Member

  • New Member
  • 5 posts
  • Version:GM8

Posted 03 May 2012 - 04:47 AM

Thanks guys.

I tranfered old GM-Scripts to Gamemaker Studio. Till GM 8.1 <break> worked like <Exit> outside the statements.

The Help from Gamemaker studio (And GM 8.1).

The break statement has the form

break
If used within a for-loop, a while-loop, a repeat-loop, a switch statement, or a with statement, it end this loop or statement. If used outside such a statement it ends the program (not the game).
  • 0

#5 GStick

GStick

    All Secrets Exposed

  • GMC Member
  • 1576 posts
  • Version:GM:Studio

Posted 03 May 2012 - 05:53 AM

Yeah, I realized that after I posted. That's why I edited my post so shortly after I posted. :confused:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users