0
Insert multiple elements into case of switch
Hi!
I would like to fit more items into a switch case but I can't.
This works:
switch 'Progress Bill' do
case 1:
'End data' := null
case 2:
'Total Price' := 0
case 3:
'End data' := null
default:
"Error"
end
This gives error:
switch 'Progress Bill' do
case 1:
'End data' := null
case 2:
'Total Price' := 0;
'End data' := null
case 3:
'End data' := null
default:
"Error"
end
This doesn't give an error but it doesn't consider the elements after "and"
switch 'Progress Bill' do
case 1:
'End data' := null
case 2:
'Total Price' := 0 and
'End data' := null
case 3:
'End data' := null
default:
"Error"
end
Thanks
5 replies
-
I think this (adding {} ) will work:
switch 'Progress Bill' do case 1: 'End data' := null case 2: {'Total Price' := 0; 'End data' := null} case 3: 'End data' := null default: "Error" end
-
Switch ... case statement needs round brackets () for multiple instructions.
Try this:switch 'Progress Bill' do case 1: 'End data' := null case 2: ( 'Total Price' := 0; 'End data' := null ) case 3: 'End data' := null default: "Error" end
-
Thanks Fabio , I knew it was something with brackets...
-
thanks Fabio and RoSoft_Steven
it works with round brackets ()
Content aside
- Status Answered
- 1 yr agoLast active
- 5Replies
- 222Views
-
3
Following