Starting Out¶
Last Change: | 13-May-2016. |
---|---|
Author: | qh73xe |
Reference: | http://learnyouahaskell.com/starting-out |
目次
Ready, set, go!¶
まずは端的につまらない復習をします。
うん、演算子...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ghci> 2 + 15
17
ghci> 49 * 100
4900
ghci> 1892 - 1472
420
ghci> 5 / 2
2.5
ghci> (50 * 100) - 4999
1
ghci> 50 * 100 - 4999
1
ghci> 50 * (100 - 4999)
-244950
|
以上。
一点注意. 負の値を設定するにはカッコが必要
1 2 3 4 5 6 7 | ghci> 1 * -3
<interactive>:3:1:
Precedence parsing error
cannot mix '*' [infixl 7] and prefix `-' [infixl 6] in the same infix expression
ghci> 1 * (-3)
-3
|