![robotc while loop robotc while loop](https://slidetodoc.com/presentation_image_h/06f4b54ac4eb17798dd46886f73d36c3/image-2.jpg)
C is not object oriented, therefore any code made using classes cannot be used in ROBOTC. If you want to use a float, you must cast the numerical value as float by preceding it with (float) or else the compiler will assume it's a double. C is less picky about data types than C#.In C#, code from other files is automatically included as long as the files are in the same directory. In regular C, you must use the #include statement to include code from other files.Here are the differences that are pertinent to programming for VirtualVEX: The word while Every while loop begins with the keyword while. There are three main parts to every while loop. Most are so minor you will never encounter them, but in certain situations you may be faced with this conflict. ROBOTC for CORTEX While Loops Part 1 While Loops A while loop is a structure within ROBOTC which allows a section of code to be repeated as long as a certain condition remains true. Since ROBOTC uses the standard C syntax whereas VirtualVEX uses C#, there are differences inthe exact syntax of your program. For more on VVDevelop, see the knowledge base page on it. Since VVDevelop is already set up to compile to VirtualVEX you do not have to go through the steps shown in the previous section that you would need for another IDE. It is linked to the gmcs compiler and supports 1-click compilation. The VVDevelop IDE is a basic development environment bundled with the VirtualVEX programming kit. Right click on the solution and select "Add Existing Item".Browse to find UnityEngine.dll and add it to the references.Once the new solution is open, go to the References panel, right click and select "Manage" or "Add Reference" depending on your IDE.A simplified version is like so, with 5U & 5D controlling the normal up & down action, and button 6D as the auto down action.
![robotc while loop robotc while loop](https://www.vexforum.com/uploads/default/original/2X/4/4134817560c84740e3433cf8f6f0104c100c498f.png)
We use the encoder value with a while loop to run the lifter down to the target value. // While the absolute value of the gyro is less than the desired rotation - 100.
ROBOTC WHILE LOOP PORTABLE
Once your code is compiled you can download it to VirtualVEX by putting main.dll the folder C:\VVData\UserCode (for the standard version) or /virtualvex_data (for the portable version). In Command Prompt, navigate to your gmcs directory and use the following command to compile: gmcs -target:library -out:main.dll -r:UnityEngine.dll source.cs.Put your code into the same directory as your gmcs install.Put a copy of UnityEngine.dll into the same directory as your gmcs install.The following example steps apply to the gmcs compiler, part of the Mono Project ( Different compilers have different ways of accomplishing these tasks. Furthermore, you must tell your compiler to link your code with UnityEngine.dll (which can be found in /virtualvex_a3 data/Managed. You must set your C# compiler to compile the code as a Class Library, also known as a DLL file. Once you have finished making your code it must be compiled for use in VirtualVEX. This is a chart of which "motors" on the virtual robot are plugged in to which "ports," which is necessary knowledge for programming the robot. VirtualVEX runs in its own control loop, and butting an additional while loop inside could lead to unexpected results. However, there is one IMPORTANT difference: do NOT put the code inside a while loop like you would in ROBOTC.
ROBOTC WHILE LOOP DRIVER
Since ROBOTC syntax is supported you can program the driver code just as you would a regular VEX ROBOTC program. structure, and control structure with loop and if in ANSI-C, as well as basic robotics intrinsic motor functions and variables commonly used in RobotC.
![robotc while loop robotc while loop](https://docplayer.net/docs-images/40/6137192/images/page_8.jpg)
Driver code goes inside the driver_control() function. This template contains important definitions for ROBOTC constants. While (again.startsWith("y") || again.All VirtualVEX programs must be written within the source.cs template. Scanner console = new Scanner(System.in)