info@artec.bg +359 889 557 337
Artec Robotics
News item

A Guide to the Syntax of the KAREL Language for FANUC Robots

Home / News / A Guide to the Syntax of the KAREL Language for FANUC Robots

06.03.2025

KAREL is a programming language used to control FANUC robots. It's based on Pascal and designed to be easy to learn and use. This guide introduces the basic syntax elements of KAREL you need to write programs for FANUC robots.

1. Program structure

Every KAREL program starts with a declaration of the program name and ends with an END statement.

KAREL program structure

2. Comments

Comments in KAREL are written with -- and are ignored by the compiler.

Comments in KAREL

3. Variables and data types

KAREL supports several basic data types:

  • INTEGER – integers
  • REAL – floating-point numbers
  • BOOLEAN – Boolean values (TRUE or FALSE)
  • STRING – strings
Variables and data types

4. Operators

  • Arithmetic: +, -, *, /
  • Logical: AND, OR, NOT
  • Comparison: =, <>, <, >, <=, >=
Operators

5. Conditional statements

KAREL uses IF and CASE for conditional checks.

Conditional statements

6. Loops

KAREL supports FOR, WHILE and REPEAT loops.

Loops - FANUC

7. Procedures and functions

KAREL lets you define procedures and functions so code can be reused.

Procedures and functions

8. Working with the robot

KAREL provides special commands for controlling the robot, such as motion, reading sensors and more.

Working with a FANUC robot

FANUC's official website, where you can find documentation, products and contacts, is at https://www.fanuc.com

This guide provides basic information on the syntax of the KAREL language used to program FANUC robots. With this knowledge you can start writing your own robot control programs.

On the Artec Robotics “News” page you will find a variety of articles and guides on robotics and automation. Here you'll find useful information about the latest technologies, software solutions and programs that will help you dive deeper into the world of industrial robots and automated systems.

Follow the news from Artec Robotics!

MAKE AN INQUIRY

FANUC - KAREL
Contact us

Make an inquiry