Skip to content

Commit 3acc52a

Browse files
docs: add simple sum method example
1 parent 234954d commit 3acc52a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

streamerbot/3.api/3.csharp/0.guide/3.custom-methods.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ You can call your custom method from within the `Execute()`{lang=cs} method or f
1515
public bool Execute()
1616
{
1717
CustomMethod(); // Call your custom method [!code highlight]
18+
19+
int sum = Add(5, 10); // Call another custom method that takes parameters [!code highlight]
20+
1821
return true;
1922
}
2023

2124
public void CustomMethod()
2225
{
23-
CPH.LogInfo("This is a custom method!");
26+
CPH.LogInfo("This is a custom method!"); // You can even use CPH methods here!
27+
}
28+
29+
public int Add(int a, int b)
30+
{
31+
return a + b; // This method takes two integers and returns their sum
2432
}
2533
```
2634

0 commit comments

Comments
 (0)