Camelia
Prev: String repetition

if statement - comparing values

You can compare two values or scalar variables using the if statement and one of the comparison operators.

examples/scalars/if.p6
#!/usr/bin/env perl6
use v6;

my $age = 23;
if $age > 18 {
   say "You can vote in most countries.";
}


Prev: String repetition

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: