Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [WISH] $switch function (Read 1247 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[WISH] $switch function

A C-like $switch function would enable huge simplification of some title formatting scripts and make them more readable.
Its syntax could be somewhat like
$switch(cond,n1,r1,n2,r2,n3,r3...)
in which if cond value is equal to n1, result would be r1 and so on; if no match, result would be an empty string.
To make it as simple as possible, n could be required to be a number and there would be no else clause.

Re: [WISH] $switch function

Reply #1
Sounds like $select() which is already there.


 

Re: [WISH] $switch function

Reply #3
While I agree that it's not the same, I suspect it'll be pretty close to whatever his use case is. But perhaps OP can elaborate on what that is exactly.

In the meantime here is an example:
Code: [Select]
$select(%tracknumber%),
this is track 1,
this is track 2,
this is track 3)