加法运算符

main = do
let var1 = 2
let var2 = 3
putStrLn "The addition of the two numbers is:"
print(var1 + var2)


The addition of the two numbers is:
5


减法运算符

main = do
let var1 = 10
let var2 = 6
putStrLn "The Subtraction of the two numbers is:"
print(var1 - var2)


The Subtraction of the two numbers is:
4


乘法运算符

main = do
let var1 = 2
let var2 = 3
putStrLn "The Multiplication of the Two Numbers is:"
print(var1 * var2)


The Multiplication of the Two Numbers is:
6


分部运算符

main = do
let var1 = 12
let var2 = 3
putStrLn "The Division of the Two Numbers is:"
print(var1/var2)


The Division of the Two Numbers is:
4.0


序列/范围操作符

main :: IO()
main = do
print [1..10]


[1,2,3,4,5,6,7,8,9,10]

↑回到顶部↑
WIKI教程 @2018