User Tag List

Results 1 to 2 of 2

Thread: Switch..case statement???

  1. #1
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,507
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.88%

    Question Switch..case statement???

    from what i understand zscript is basically the C language with built in functions, so why does it not seem to understand a switch statement?

    example of code i wrote:

    Code:
     
    switch (best_dir) 
     {
      case 1:
      for (int n = 1 ; n<16 ; n+=4)
      {
      this_ffc->y-=4
      Waitframe();
      }
      break;
      case 2:
      for (int n = 1 ; n<16 ; n+=4)
      {
      this_ffc->x-=4
      Waitframe();
      }
      break;
      case 3:
      for (int n = 1 ; n<16 ; n+=4)
      {
      this_ffc->y+=4
      Waitframe();
      }
      break;
      case 4:
      for (int n = 1 ; n<16 ; n+=4)
      {
      this_ffc->x+=4
      Waitframe();
      }
      break;
     }
    Am i useing this wrong or is it not possible to use switch
    (or is it select..case, i always get confused when useing different languages )

  2. #2
    Administrator DarkDragon's Avatar
    Join Date
    Oct 2001
    Posts
    6,228
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    11,030
    Level
    31
    vBActivity - Bars
    Lv. Percent
    8.71%

    Re: Switch..case statement???

    Because I haven't implemented it yet.

    Switch is very nasty to implement in a compiler, as it's complex both in terms of syntax and semantics, and so didn't make ZScript's first cut. Which is not to say I won't get around to it in the future.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social