processing / processing/processing-website

nf() function description inadequate

Offen
#353 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
MDX
Sterne
90
Forks
122
Ø Merge
1 Std. 43 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Issue description

nf() function reference could use a better description. As of now the text says:

Utility function for formatting numbers into strings. There are two versions: one for formatting floats, and one for formatting ints. The values for the digits and right parameters should always be positive integers. The left parameter should be positive or 0. If it is zero, only the right side is formatted.

This text only states that an int and a float version is existent. Nowhere is it explained how those are different. Referring to this description a call like nf(float, int) would be valid. This call however is not functional as passing num as a float variable requires to specify a left and right parameter (so the call has to be nf(float, int, int)).

This could be confusing to beginner programmers.

URL(s) of affected page(s)

https://processing.org/reference/nf_.html

Proposed fix

In my opinion ideally, in line with single responsibility, these would be two functions.

However an extended description should also do the trick.
The text could be extended by a paragraph similar to:

When num is a variable of type float the call becomes nf(num, left, right). left represents the formatted number left of the decimal point and right represents the formatting right of the decimal point.

Alternatively it could be made clear in the Syntax and Parameter section which call allows which parameters.

nf(numf, left, right)
nf(numsf, left, right)

numf = float: the number to format
numsf = float[]: the numbers to format

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Öffne die betroffene nf()-Referenzseite unter processing.org/reference/nf_.html und überprüfe ihre aktuelle Beschreibung sowie die Abschnitte Syntax und Parameter. Kläre die unterschiedlichen Aufrufformen und erforderlichen Parameter für float- und array-Eingaben. Die Arbeit ist abgeschlossen, wenn ein Anfänger erkennen kann, welche Signatur für jeden Eingabetyp gilt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.