# Class Definition Error

**URL:** <https://forum.dynamobim.com/t/class-definition-error/77898>\
**Category:** DesignScript\
**Created:** [June 22, 2022, 2:08pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898 "2022-06-22T14:08:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mclough](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mclough/32/134664_2.png) [@mclough](https://forum.dynamobim.com/u/mclough)\
**Post date:** [June 22, 2022, 2:08pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/1 "2022-06-22T14:08:01Z")

</div>

I’m trying to build a class, but i get an error stating

> Error: ‘;’ is expected

```auto
class Profile
{
	department = " ";
	subDepartment = " ";
	name = " ";
	count = 0;
	area = 0.0;
	comments = " ";
	guidelines = " ";
	id = " ";

	constructor ByValues (d, sD, n, ct, a, cm, g, id)
	{
		this.department = d;
		this.subDepartment = sD
		this.name = n;
		this.count = ct;
		this.area = a;
		this.comments = cm;
		this.guideline = g;
		this.id = id;
	}
};

```

I copied some code from the spec document and that fails in the same way. I feel like there’s something really basic i’m missing here, but am having trouble finding other tutorials

```auto
class Point2D
{
	x = 0;
	y = 0;

	constructor ByCoordinates (x,y)
	{
		this.x = x;
		this.y = y;
	}
};

```

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [June 22, 2022, 2:31pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/2 "2022-06-22T14:31:38Z")

</div>

It seems like you are missing a `;` after _this.subDepartment = Sd_

---

<div class="post-metadata">

**Author:** ![mclough](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mclough/32/134664_2.png) [@mclough](https://forum.dynamobim.com/u/mclough)\
**Post date:** [June 22, 2022, 3:09pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/3 "2022-06-22T15:09:49Z")

</div>

hmm. yep. this is definitely true. i added the ; and it still gives the same error

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/4/242a2ba366cc113da6018ec861ae677619c1ad93.png)

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [June 22, 2022, 3:28pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/4 "2022-06-22T15:28:20Z")

</div>

DesignScript is not exactly the same as C#, it is another language.

What are you trying to create exactly? PS: I don’t know what you are referring to with “class”

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [June 22, 2022, 4:32pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/5 "2022-06-22T16:32:35Z")

</div>

> [@mclough](#):
>
> I’m trying to build a class,

You cannot do this in a Code Block  
With a few changes to your code, possible in a file with a _.ds_ extension

```auto
class Profile
{
	department;
	subDepartment;
	name;
	count;
	area;
	comments;
	guidelines;
	id;

	constructor ByValues (d, sD, n, ct, a, cm, g, id)
	{
		this.department = d;
		this.subDepartment = sD;
		this.name = n;
		this.count = ct;
		this.area = a;
		this.comments = cm;
		this.guideline = g;
		this.id = id;
	}
}

```

On importing the .ds file into Dynamo, nodes are created.  
However, this doesn’t work too well 😏

![class](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/768d380f990e38e7b48679991eb6307ea84ea301.gif)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [June 22, 2022, 6:01pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/6 "2022-06-22T18:01:09Z")

</div>

Hello, and thank you for sharing knowledge, the incoming are all string, in this situation?

Thanks  
Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![mclough](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mclough/32/134664_2.png) [@mclough](https://forum.dynamobim.com/u/mclough)\
**Post date:** [June 22, 2022, 7:42pm UTC](https://forum.dynamobim.com/t/class-definition-error/77898/7 "2022-06-22T19:42:16Z")

</div>

ah. i overlooked the line in the Design Script Guide: just like you said.

> Note:​ Classes can only be declared in DesignScript script files or files that have a .DS extension. Class  
> declarations are not allowed in code block nodes in Dynamo. DS files can be imported into a Dynamo  
> session to be consumed as nodes.

i was trying to streamline the management of a ‘profile’ as part of a space planning graph. currently, i’m using a dictionary, but thought it would be nicer to just be able to use . access notation. Also recognize that classes are something that i don’t really understand to well so i thought this might be the right situation to use it.
