Rosetta Code:Solve a Task: Difference between revisions

From Rosetta Code
m (Undo revision 332361 by Sabin (talk)Undo destructive edits)
Tag: Undo
m (Thundergnat moved page Rosetta Code:Benford's law to Rosetta Code:Solve a Task over redirect: revert destructive edits)
(No difference)

Revision as of 08:53, 20 October 2022

So you'd like to solve a task? Great! Here's a brief walkthrough on how you might do that. While you may already have a task and a language in mind, we're going to assume the language is "Ayrch", and the task is Hello world. If the language you're familiar with doesn't already have a presence on Rosetta Code, consider going through the motions of adding a language. If you don't have a task in mind, check out our lists of unsolved tasks.

The Basics

Quickly getting started, this is all you really need to do.

Copyright

Please familiarize yourself with Rosetta Code's copyright policies. If you want the layman's summary: Don't post code you don't have permission to, and be aware that you're giving us (and others) permission to use it under specific conditions.

It is best to read the task thoroughly, solve it, and check your solution ''before'' starting to edit the Rosetta Code page, (especially for tasks needing more than a very short solution).

10 DEF FNBENFORD(N)=LOG(1+1/N)/LOG(10)
20 CLS
30 PRINT "One digit Benford's Law"
40 FOR i = 1 TO 9
50   PRINT i,:PRINT USING "##.######";FNBENFORD(i)
60 NEXT i
70 END

Going a little further

If you want to give your code that spit and polish shine, there are a few more steps you can take.

Comments and Description

Consider adding descriptions to your code examples, to help the reader understand what's going on. This is particularly helpful if your code or language paradigms are very unlike ones that are already commonly known. Regardless, it's considered good practice in any environment where you would like other people to understand what you've written.

Libraries

It's perfectly all right to depend on external (or even non-standard) libraries in your code examples. However, it can be problematic for others if they don't know they need to use a library, or don't know where to find it. There's a template for that: libheader.

=={{header|Ayrch}}==

{{libheader|Ayrch Console Extensions}}

<syntaxhighlight lang="ayrch">PRINT "Goodbye, World!"</syntaxhighlight>

Works With

Not all code works with all versions of a language, all versions of a compiler, interpreter or other implementation, or even all operating systems that the language may run on. If you're aware of certain constraints or other prerequisites that haven't already been mentioned, try using the works with template.

=={{header|Ayrch}}==

{{works with|Ayrch Virtual Machine|6.2}}

<syntaxhighlight lang="ayrch">PRINT "Goodbye, World!"</syntaxhighlight>

Conclusion

Thank you for adding code, and even more thanks if you added the spit and polish to make your code shine!

Where to go?

Now that you've solved one task, you might like to be reminded that there are lists of all the unsolved tasks for all of the languages that have a presence on Rosetta Code. If your preferred language isn't there, then you may need to go through the motions of adding a language in order to get the site software to automatically generate the list.