Question regarding the switch function, and a thought

For general Flowcode discussion that does not belong in the other sections.
Post Reply
alanwms
Posts: 155
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 8 times

Question regarding the switch function, and a thought

Post by alanwms »

Is it possible to use a string for the switch function?

Thought:
Such a simple idea, but it would be nice to incorporate either automatic or manual file backups.

Steve-Matrix
Matrix Staff
Posts: 1994
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 297 times
Been thanked: 461 times

Re: Question regarding the switch function, and a thought

Post by Steve-Matrix »

If you mean the Switch command icon, then not exactly. That said, you can create a set of constants with appropriate names and unique integer values, and then use those throughout your project. These could then be used in a Switch statement and would be make the code a lot more readable and easy to understand.

As for your second point, there are automatic backup options in the Global Options screen.

medelec35
Valued Contributor
Posts: 2336
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 730 times
Been thanked: 785 times

Re: Question regarding the switch function, and a thought

Post by medelec35 »

Would the attached example work for you?
You can use single string chars for the switch function.
Attachments
Using string for switch function.fcfx
(11.6 KiB) Downloaded 64 times
Martin

alanwms
Posts: 155
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 26 times
Been thanked: 8 times

Re: Question regarding the switch function, and a thought

Post by alanwms »

The attached helped but - - I can get the if block to work but my switch simply falls through
Untitled.jpg
Untitled.jpg (55.53 KiB) Viewed 198 times

medelec35
Valued Contributor
Posts: 2336
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 730 times
Been thanked: 785 times

Re: Question regarding the switch function, and a thought

Post by medelec35 »

You will required something on each of the Switch function branches to determine if code is working or not.
If you post your fcfx project file, I can have a look at it for you
Martin

Post Reply