Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Mizui
Newbie


Joined: 05 May 2010
Posts: 6

PostPosted: Wed May 26, 2010 4:48 am   

Switch Cmd Bug?
 
I am not sure if something is wrong with the switch function or if I did something wrong

This is part of my code, i think the code is pretty much self explainatory:

Code:

#sh %eval($aCon != $bCon);
#switch {$aCon != $bCon} {#sh case 1;$case = 1}
{$aCon = $bCon && $c == $d} {#sh case 2;$case = 2}
{$aCon = $bCon && $c > $d} {#sh case 3;$case = 3}
{$aCon = $bCon && $c < $d} {#sh case 4;$case = 4}
{#sh {%ansi(high,red)Fail at Switch Case!}};

The output:

> 0
case 1

If %eval($aCon != $bCon) shows 0,
output shouldn't show case 1.

Wondering if this is a bug that I should report or I am just stupid and overlook something.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed May 26, 2010 4:58 am   
 
{} no longer works as () in CMud.
_________________
EDIT: I didn't like my old signature
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed May 26, 2010 5:47 am   
 
To elaborate, the correct syntax is:

#SWITCH (expression) {commands} (expression2) {commands2}

It's the same with #IF statements:

#IF (expression) {true} {false}

not

#IF {expression} {true} {false}

Charneus
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net