0

This is the error code

 error: unresolved reference: string (myfirstfile.kts:1:22)

myfirstfile.kts:1:22: error: unresolved reference: string

fun main(args: Array<string>) {
                     ^ww33
Ivo
  • 18,659
  • 2
  • 23
  • 35
  • Does this answer your question? [Kotlin unresolved reference in IntelliJ](https://stackoverflow.com/questions/31712046/kotlin-unresolved-reference-in-intellij) – Adedoyin Akande Nov 05 '21 at 09:34
  • Did you try writing the name of the "String" class starting with the big S ? I think, in Kotlin class names are case sensitive – Arthur Klezovich Nov 05 '21 at 10:46

1 Answers1

2

I'm guessing because it looks like you modified your code before pasting it here, because the error doesn't match what you're showing.

I'm guessing you had

fun main(args: Array<string>) {

and that doesn't work because there is no class named string. It's named String with a capital S. By convention, all class names start with capital letters. (It's possible to define a class name without an initial capital letter, but no one does this because it makes your code hard to read.) It should look like this:

fun main(args: Array<String>) {
Tenfour04
  • 83,111
  • 11
  • 94
  • 154