Camelia
Prev: Junctions in Perl 6

Junctions

As we already seen in a previous chapter we can use a junction to check if a values is among a given set of values

examples/junctions/intro.p6
#!/usr/bin/env perl6
use v6;

my $possible_options = 1|2|3;
my $c = prompt "please give a number(1,2 or 3): ";
if $c == $possible_options {
    say "Correct choice: $c";
} else {
    say "Incorrect choice: $c";
}


Prev: Junctions in Perl 6

Table of Contents

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: