Featureful / about / components / FeatherCalculator.md
Feather Calculator
A calculator, with more features than you might expect...
It evaluates expressions using the Feather
scripting language.
Usage
Type an expression, then press the friendly =
button.
Only kidding, I never use the button, but it's handy as a reminder for the
evaluatate
keyboard shortcut.
The default is Ctrl+Enter (but you can change this if you want)
This evaluated the current line of text. To evaluate a block of code, or an expression which spans multiple lines :
Selected a block of text, then press the friendly =
button (or Ctrl+Enter).
Runner Prefix
FeatherCalculator adds a =
prefix for Runner, so that you can type
any expression into a Runner
input field.
I have a runner field slap bang in the middle of the main toolbar :
i.e. My Personal
project contains :
toolbar(
spacer,
Runner.runnerInput( projectFolder() )
)
Comparison with Traditional Calculators
The font is the same size as all the other text. Why do other computer calculator use such a HUGE font?
Type, rather than push buttons. Why do other computer calculators have buttons, when your keyboard already has them?
Now that we've de-cluttered the UI, we have lots more space, so why not show ALL lots of expressions, and their results.
The final result is a TEXT AREA. Each line is either an expression you have typed, or the result.
Not just Maths
As we have a complete scripting language, you can do more than just maths.
A silly example :
$(whoami).eval().trim() + " woz here"
This runs the command whoami
, and appends some text.
FYI, I needed "trim()" to get rid of the newline character. Hmm.
To run a block of code, highlight the block, and press Ctrl+Enter. e.g. :
var sum = 0
for ( a in 0..10 ) {
sum += a
}
sum
Blocks Without a Value
This currently doesn't work :
for ( a in 0..10 ) {
println( "Hello" )
}
Because it gets confused by the lack of a return value. As a workaround until this is fixed, just add any value to the end. e.g. :
for ( a in 0..10 ) {
println( "Hello" )
}
"Done" // or 0 or true ...
Back to Components index.