Writing nodes in ROS-2 is comparatively different from ROS-1 due to the introduction of the additional software layers we saw in the Fundamentals of ROS-2 section. However, OSRF has ensured there isn't a huge difference while writing the ROS-2 code in order to save time and effort. In this section, we'll compare ROS-1 code and ROS-2 code and find out the differences in their usage.
Note that this is just an example section and if you want to write a ROS-2-specific package for your project, I would recommend that you go through the ROS-2 tutorials page (https://index.ros.org/doc/ros2/Tutorials/), which contains the necessary information.