Downloaded first exercise (Hello World), wrote the code both on my local machine and even used the online editor, nevertheless can’t pass the test. can someone provide me some direction.
thank you
Downloaded first exercise (Hello World), wrote the code both on my local machine and even used the online editor, nevertheless can’t pass the test. can someone provide me some direction.
thank you
You’ll have to provide more details. Paste your code here
Hate to be that guy but… Did you read the instructions correctly?
The function should return the string Hello, World!, not hello world, Hello world, or Hello World. And ofc as Glenn said, kindly provide more details.
Or could it be a general problem with test runners? Uploaded a C exercises 10 minutes ago. Still “processing”.
I guess, @iHiD could probably check when online. I know the Go test runner had issues before but that was solved almost a month ago.
Does the test only fail on Exercism or does it fail locally to @Badiuss?
I read about timeouts for Rust exercises, too. Seems not limited to Go.
In addition to what @thinkverse suggests:
@Badiuss Did you return the string? Some newcomers print it instead and then find that the tests will not pass. The instructions tell you to return it.
(For anyone else coming across this, this is a solution-specific error)
I used this code
package main
import “fmt”
func main (){
fmt.Println (“Hello World!”)
}
Nevertheless I didn’t work in the online editor nor with CLI tool
Thank you for the help you can provide
I just begin to learn programming recently, so I tried to code the basic I’ve learned so far, and I’ve seen the code I posted up there works everywhere else, so that’s why I’m so confused on what I’m doing wrong
Maybe that’s my mistake, I come with the most basic approach to solve it, which was just to print, I’ll try to learn about functions and try again, and will let you people know. Thank you for the messages, as I mentioned I’m brand new to programming so I still lack a lot of logic or wys on how to properly address a problem.
Ah, welcome to the craft!
Some advice that is very widely applicable:
Do not share code through screenshot, but rather through textual copy. (You already did this; thanks )
For ease of reading, properly format your code. Here (and in lots of other places) this can be done through code blocks:
```python
print("Hello, World!")
```
renders as
print("Hello, World!")
Provide relevant context
This is hard: most of the time when you have a problem you are in fact missing something and so cannot think of all relevant information to provide. This is extra difficult when you are an absolute beginner. It’ll become easier with time.
You did quite well here. You mentioned the exercise, that you tried both locally and online, that you were having trouble with the tests, and (though I missed it) the language used. Almost all of this information was useful for us, and allowed us to guess the problem. A thing to improve: failing tests tend to come with helpful messages. These are intended to be read and understood. It is advisable to get into the habit of actively reading error messages and googling words that seem important. Such a habit will be very useful in the long term. If you can’t figure it out, when asking for help please also include the error messages, wholly.
This solution prints a string to the standard output.
This exercise requires the function return a string value to the caller.
Printing and returning are not the same.
Got it, will try to do it that way…
Go’s documentation is IMHO a bit lacking compared to other languages.
Step-by-step guides are pretty nonexistent, and those that do exist are either underdeveloped, expect you to have some programming knowledge already, or are using third-party packages.
But you can find what you’re looking for if you click around enough for instance - A Tour of Go does cover functions.
Another valuable resource that’s great to refer to is Go’s language specification. For your issue, it’d be Function declarations and Return statements.
Hope those resources help you out.
I’ve looked and learnt a lit bit about functions, and nevertheless the code doesn’t seem to work. This time I used this:
package main
import “fmt”
func main() {
sayHi()
}
func sayHi (){
fmt.Println(“Hello, world!”)
return
}
And tho it runs perfectly in the compiler, Exercism says is wrong, I don’t know what else to do.
As mentioned earlier, your function must return “Hello, World!” and not print this string.
The hello_world.go
file contains everything you need to complete the exercise. Adding other functions to the file or changing the package
declaration is unnecessary.
package greeting
// HelloWorld greets the world.
func HelloWorld() string {
return "Goodbye, Mars!"
}
The exercise instructions give a clear objective as well.
Write a function that returns the string “Hello, World!”.
You have one part of that objective already when you start the exercise.
And as I’ve mentioned previously and as @deleted-user-33691 also pointed out, it’s a great idea to start and take A Tour of Go.
You made it super clear… Thank you… And thanks everyone for all the support and documentation