Troubleshooting a simple codeblock error

New to the forum and coding in general.

I’m trying to put together a simple code in Revit 2019. Something to practive like change a workset just to help me on my way to learning to make more powerful scripts. Currently my codeblock only reads "Error: ‘;’ is expected but I can’t understand why.

Unfortunately as a new user I can’t upload the file so a screenshot will have to do:

I don’t really need this code so I’m not looking for anyone to write something new, just wondering if this one can be fixed or if it would just be better to try using the visual nodes to create scripts from now on?

Thanks for any help!

Put a ; on the very last line to start with. You may need it in a few places actually.

I find it helps to comment out everything in a definition (\ before the line) except for “return 1” to start with until you get the format right.

Thanks for the incredibly fast response!

I went through the steps you gave me and after commenting my lines I didn’t get much change however if I comment out my top two lines I do get a kw_class expected error.

I looked into that error a bit and from what I understand I don’t think that is the issue as when I put my first two lines back I’m right back to the ‘;’ error.

after testing a few lines I just don’t see where this ‘;’ is supposed to be.

This doesn’t look like DesignScript. C#?

Code blocks in Dynamo use the DesignScript language. You can also drop in Python nodes. If you wish to use C# you’ll have to go via an IDE of some sort to create a library and JSON to bring into Dynamo as a zero-touch node.

3 Likes

I think theres a c# node floating around on the package manager - but yeah, you can’t write c# in a dynamo codeblock.