This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

error: "extra switch pattern with no body"

Old posts that have not been replied to for several years.
Locked
n
netux
Voice
Posts: 19
Joined: Fri Jul 30, 2004 8:42 pm

error: "extra switch pattern with no body"

Post by netux »

Hi ppl, search here in forum and over the net for the solution of my problem without sucess :/
here´s an example of the code i have:

Code: Select all

switch -- $s {
    "a" {
      switch -- $s1 {
        "a1" {....}
        "a2" {....}
      }
    }
    "b" {
      switch -- $s1 {
        "b1" {....}
        "b2" {....}
      }
    }
}
is it possible to have a switch inside a switch?
if not is there another way to do it?
tks
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You mean nested switches?
Hmm... I am not sure :roll:

The only way to find out is to give it a test, I guess. :mrgreen:
Although I think it should work, as all types of loops can be nested as well!
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

nested switches works
error: "extra switch pattern with no body" <- this error usually appears when you have a comment inside your switch

Code: Select all

#this works
switch  -- $s {
  {a} { 
     ....bla
     #comment
  }
}

#...while this will give you the error
switch  -- $s {
  #comment
  {a} { 
     ....bla
  }
}
Elen sila lúmenn' omentielvo
n
netux
Voice
Posts: 19
Joined: Fri Jul 30, 2004 8:42 pm

Post by netux »

tks papillon, i remove the comment inside switch and worked fine.
tks for your answer.
Locked