Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
typeof?
brooke_spreen
Member, Developers Posts: 115 ✭✭✭
Is there an analog of Javascript's "typeof" in Featurescript?
In other words, is there a way to ask the open-ended question "what is the type of this variable"?
Note that this is a different question than "is this variable of the type 'myType'", which returns a boolean.
As an example, when debugging, it would be very useful to do:
println(typeof myVar);
example output:
Array
or
Query
Design Engineer | Anerdgy AG
1
Comments
If(myVar is Plane)
{
}
else if(myVar is Query
{
}
elseif(myVar is Array)
{
}
else if(myVar is Map)
{
}
it works for any type and passes through the type check function of each type.