Xavier Wallace pumped his hands into the air after successfully navigating a race car across the Hot Wheels finish line.

“This game is fun!” the 8-year-old shouted in a classroom, among a dozen other second- and third-grade students trying to figure out how to use their laptop computers to traverse an Angry Birds maze or help Elsa from “Frozen” ice skate.

Get unlimited digital access $14.99 A MONTH

Xavier Wallace pumped his hands into the air after successfully navigating a race car across the Hot Wheels finish line.

“This game is fun!” the 8-year-old shouted in a classroom, among a dozen other second- and third-grade students trying to figure out how to use their laptop computers to traverse an Angry Birds maze or help Elsa from “Frozen” ice skate.

But the students weren’t playing video games. They were learning how to program, or code, the games.

The free Hour of Code class Saturday was offered for the first time to locals by Park Shore Country Day Camp’s Extreme STEAM Science Kids program in Dix Hills.

The Hour of Code is a global initiative that focuses on expanding participation in computer science and coding. It reached more than 100 million people in 2014, according to the event’s organizers. The movement, organized by Code.org — a nonprofit organization dedicated to expanding access to computer science and increasing participation by women and underrepresented students of color, is supported by President Barack Obama, Microsoft co-founder Bill Gates and Facebook creator Mark Zuckerberg.

At Saturday’s class, children wrote various lines of code by using a programming tool that grouped lines of code in blocks. The programmers-in-training had to organize the blocks of code — with commands such as “move forward” or “turn right” — in the proper order to instruct a character on how to move.

Hour of Code instructor Samantha Coiro told the children a programmer was similar to the author of a book, using a computer language to direct characters. “It’s OK if you do it wrong,” she told the class, after demonstrating on a Smart TV. “You can go back and try it again!”

Xavier, of Wheatley Heights, who later said he wanted to gain more experience to one day be able to program castles and action scenes, said he enjoyed learning how to code.

“The best thing is that they actually teach you in a fun way. Sometimes when the grown-ups try to teach the kids, the kids are like blah!” he said, indicating a look of boredom.

Hayden Lamkin, 7, said it was difficult to learn what programming blocks to move at times, but many of the games provided helpful hints. “You can learn that if you do it, then it can make you a better programmer,” said Hayden, of Melville.

Coiro, who also teaches computer science at Park Shore, said the program was a “hands-on, fun learning experience to bring technology to children to demystify the concept of coding and computer science.”

Leslie Watnik, curriculum consultant for Extreme STEAM, said she hoped the event would “light a fire under them [the children], so they can turn around and say, ‘Hey, I know how to code’ . . . it doesn’t have to stop here.”

That was true for 6-year-old Gabriel Patnode, of Deer Park, who attended a session for kindergarten and first-grade students. He had been talking about coding at school, so his parents wanted to introduce him to more of it, said his dad Stephen Patnode, 45. “It’s a different world than the one I grew up in,” he said.

Gabriel said “Flappy Bird” was his favorite program. “It’s like very, very hard,” he said. “You actually have to flap and click very quickly or else you’re going to fall down, game over!”

Xavier’s mother, Lydia Wallace, 40, who is a systems analyst, said it was important for kids to find early pathways for success in science and technology, particularly for minorities.

“It’s great to have opportunities as African Americans to learn something like this because a lot of times we don’t see that as a possibility,” she said. “To actually see there are other kids, like African Americans, girls, boys, everybody has the opportunity — if this can spread across the state that would be great!”