Could not find Char in the Current Scope

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By givenmnisi6

I get the error: Could not find type “Char” in the current scope, is even Char a data type in GDScript?

Here is the code:

func get_index(s: String, t: Char, n: int) → int:
var count = 0
for i in range(s.length() - 1):
if s[i] == t and s[i + 1] == t:
count += 1
if count == n:
return i
return -1

:bust_in_silhouette: Reply From: kidscancode

There is no “char” datatype in GDScript - use String.

Okay, thank you.

givenmnisi6 | 2023-06-13 21:57