Chemical calculator: Difference between revisions

Content added Content deleted
imported>Friman
m (→‎{{header|Wren}}: Minor tidy)
 
Line 4,655: Line 4,655:
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
{{libheader|Wren-str}}
{{libheader|Wren-str}}
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt
import "/str" for Char, Str
import "./str" for Char, Str


var atomicMass = {
var atomicMass = {
Line 4,829: Line 4,829:
for (molecule in molecules) {
for (molecule in molecules) {
var mass = evaluate.call(replaceParens.call(molecule))
var mass = evaluate.call(replaceParens.call(molecule))
System.print("%(Fmt.s(17, molecule)) -> %(Fmt.f(7, mass, 3))")
Fmt.print("$17s -> $7.3f", molecule, mass)
}</syntaxhighlight>
}</syntaxhighlight>


Line 4,846: Line 4,846:
Uue -> 315.000
Uue -> 315.000
</pre>
</pre>

=={{header|zkl}}==
=={{header|zkl}}==
Really bad error checking
Really bad error checking