Variable names starting with an integer?

Does UiPath allow the creation of variables that begin with an integer? - Example: “1strValue”

I’m busy creating credential assets to pull from Orchestrator, and Orchestrator has allowed the credential asset to be named something similar to “1assetname”. However, when I try to create the same variable in UiPath it returns the error message: “Given name is not a valid variable name!”

In fact, if I try to create any variable (string, boolean, generic, etc ) that begins with an integer, I get the same error message. What is interesting is that if the integer is NOT the first letter of the variable name, then UiPath accepts it without returning an error message - Example: “Str2Variable”

So I’m just wondering if this is intentional or a ‘random feature’ of UiPath?

Note: I’m currently using UiPath Studio 2018.4.5, running on Microsoft Windows 10 Pro 64-bit with .NET Framework Version 4.7.1

This is an intentional design choice (and a technical necessity) of almost every single programming language ever created. It is not related to UiPath in any way. If variables can start with numbers then that can lead to some cases where the computer doesn’t know how to compile certain items into code, and thus can’t run. This was more of an issue with older machines and languages but still causes problems today, so most languages do not allow this.

If you want to get more in depth here’s a Stack overflow thread with some more detail:

1 Like

Excellent! Thanks for the speedy reply, Daniel - and the extra information. That solves the issue.

Just chuckling to myself that I’ve never encountered it before, simply because I’ve followed the naming conventions that I learned from others. So I’ve been doing things more or less correctly (up until now) without ever asking why. :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.