processing / processing/processing-website

nf() function description inadequate

Aperta
#353 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
MDX
Stelle
90
Fork
122
Merge medio
1h 43m
PR unite (30g)
3

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Apri la pagina di riferimento nf() interessata all’indirizzo processing.org/reference/nf_.html e rivedi la descrizione attuale e le sezioni Syntax e Parameter. Chiarisci le diverse forme di chiamata e i parametri richiesti per gli input di tipo float e array. Il lavoro è completo quando un principiante riesce a capire quale firma si applica a ciascun tipo di input.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.