From the course: Introduction to F#
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Controlling code flow - F# Tutorial
From the course: Introduction to F#
Controlling code flow
- [Instructor] There's not much point to an application that can't make decisions, so let's take a look at how control flow works in F Sharp. We're going to start with the familiar if else conditional statement, which in F Sharp is called an if then else loop. Back in our pipelines et cetera we're going to add comment up here just to remind ourselves that we're doing pipelines and composition. And we'll say control flow and this is going to be a new example. So let's say we're going to determine if we can vote or not, and that's just basically setting a minimum voting age, grabbing some input, and performing some kind of test. So we'll say let voting age equals 18 and then we'll print, "How old are you?" Input from the console. So we'll say console read line. And what we actually need is some kind of integer, not a string, so we'll parse this. We can say let age equals and we can use the Int32 class or type and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.