Integers

Integers

Integers are a fundamental data type in Apex used to represent whole numbers (numbers without a fractional component). They can be positive, negative, or zero.

Example

// Declaring and initializing an Integer
Integer numberOfStudents = 25;

// Performing arithmetic with Integers
Integer score1 = 80;
Integer score2 = 95;
Integer totalScore = score1 + score2;

System.debug('Total score: ' + totalScore); // Outputs: Total score: 175
Apex Code Editor

Welcome to Lightning Challenge!

Create an Account

Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.

Create account

How It Works

  • • Write your solution in the code editor
  • • Connect your Salesforce org to test
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Note

Complete this lesson challenge to earn points and track your progress. The code editor allows you to implement your solution, and the tests will verify if your code meets the requirements.

Wally Assistant

Wally can't hear you

Please sign in to access the AI Assistant

Sign In