DEV Community

AllenZhu
AllenZhu

Posted on • Edited on

F# For Dummys - Day 4 Value

Today we learn how to define and store a value

there are different types of value, we introduce 4 of them

  • bool is data type indicate yes or no Image description
let is_this_apple: bool = true
let is_this_orange: bool = false
Enter fullscreen mode Exit fullscreen mode

: bool is type hint, tell compiler type of the variable we define is bool, normally we omit the type hint, as compiler is smart enough to infer the type itself, so we can also define as below

let is_this_apple = true
let is_this_orange = false
Enter fullscreen mode Exit fullscreen mode
  • int is integer Image description
let number_of_people_in_family: int = 5
Enter fullscreen mode Exit fullscreen mode
  • string is a section of text Image description
let dream_of_girl = "have food with grandma in warm place"
Enter fullscreen mode Exit fullscreen mode
  • float and double is decimal, a number with fraction part Image description
let price_of_milk = 1.19
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay