Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syntax error near unexpected token `(' in rust [closed]

Tags:

syntax

rust

I typed my first code in rust. The helloworld. But I got an error when I tried to run it.

fn main() {
    println!("Hello world");
}

I tried to run using './hellworld.rs' But it showed,

syntax error near unexpected token `('
`fn main() {'
like image 856
Rajashree Avatar asked Sep 17 '25 07:09

Rajashree


1 Answers

I was using powershell. But used the wrong command ./helloworld.rs Instead I tried ./helloworld and ./helloworld.exe. Both worked.

like image 177
Rajashree Avatar answered Sep 19 '25 15:09

Rajashree