Rosetta Code:Solve a Task: Difference between revisions

Restored to undamaged version
(→‎Adding Code: Extra hint to help against some misspellings, links to redirect pages will still show in blue)
(Restored to undamaged version)
Tag: Manual revert
 
(47 intermediate revisions by 17 users not shown)
Line 1:
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 [[UserHello Outputworld]]. If the language you're familiar with doesn't already have a [[:Category:Programming Languages|presence on Rosetta Code]], consider going through the motions of [[Rosetta Code:Add a Language|adding a language]]. If you don't have a task in mind, check out our [[:Category:Unimplemented_tasks_by_language|lists of unsolved tasks]].
 
=The Basics=
Line 13:
 
==Adding Code==
Language examples on each page are in alphabetical order, so you need to find where your example would fit. Once you've found that, click the "edit" link closest above the area where you want to insert your code on the task page, and add something like this to the bottom of the edit field:
 
<pre>
Language examples on each page are in alphabetical order, so you need to find where your example would fit. Once you've found that, click the "edit" link closest above the area where you want to insert your code, and add something like this to the bottom of the edit field:
<pre>=={{header|Ayrch}}==
 
<syntaxhighlight lang Ayrch="ayrch">PRINT "Goodbye, World!"</lang></presyntaxhighlight>
<pre>=={{header|Ayrch}}==
</pre>
 
Remember, for the sake of simplicity, we're assuming your language is Ayrch, and the task is [[UserHello Outputworld]]. We're also assuming, for the moment, that Ayrch looks a lot like BASIC.
<lang Ayrch>PRINT "Goodbye, World!"</lang></pre>
 
Remember, for the sake of simplicity, we're assuming your language is Ayrch, and the task is [[User Output]]. We're also assuming, for the moment, that Ayrch looks a lot like BASIC.
 
Once you've added your code, hit the preview button to make sure you crossed all your T's and closed all your tags. If the language name shows up in red (a broken link), then either the language doesn't exist on the site yet (as a category), or you misspelled/mis-capitalized the name. Check your spelling against the one in [[:Category:Programming Languages]].
 
That's all you really need to do!
 
=Going a little fartherfurther=
 
If you want to give your code that spit and polish shine, there are a few more steps you can take.
Line 36 ⟶ 33:
==Libraries==
 
It's perfectly alrightall 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'''.
 
<pre>
<pre>=={{header|Ayrch}}==
 
{{libheader|Ayrch Console Extensions}}
 
<syntaxhighlight lang ="ayrch">PRINT "Goodbye, World!"</lang></presyntaxhighlight>
</pre>
 
The '''libheader''' template identifies that your code uses that library, and will even provide a link to where a description of that library may be found.
 
==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.
 
<pre>
<pre>=={{header|Ayrch}}==
 
{{works with|Ayrch Virtual Machine|6.2}}
 
<syntaxhighlight lang ="ayrch">PRINT "Goodbye, World!"</lang></presyntaxhighlight>
 
</pre>
 
=Conclusion=
 
Thank you for adding code, and even more thanks ofif you added the spit and polish to make your code shine!
 
==Where to go?==
7,795

edits