Professor: Including programming syntax in Questions and Discussions

Including programming syntax and computer code in your Top Hat questions and discussions is possible using code wrap brackets.

The process is fairly straightforward, you simply want to wrap your coding syntax in code wrap brackets. Let’s work through an example together:

  1. start by typing [code] to indicate that what follows is programming syntax
  2. type your programming syntax:

    int i = 0;
    int output = 0;
    while (i<10)
    {
    output++;
    i++;
    }
    return output;

  3. end by typing [/code] (notice the direction of the slash) to indicate the end of your programming syntax
  4. in this example, your final input would be: 

    [code]
    int i = 0;
    int output = 0;
    while (i<10)
    {
    output++;
    i++;
    }
    return output;
    [/code]
  1. saving your Top Hat question will render your programming syntax with proper formatting

Note: in order for indentation to be kept, you should not have blank lines between your code. If you need to separate your code, you can use more than one [code]...[/code] block. For example:

[code]
int i = 0;
int output = 0;
while (i<10)
{
output++;
i++;
}
return output;
[/code]

[code]
int i = 0;
int output = 0;
while (i<10)
{
output++;
i++;
}
return output;
[/code]

 

Support
Should you require further assistance with Top Hat, our Support Team is here to help! You can contact us directly by way of email (support@tophat.com), the in app support button, the red Can’t find what you are looking for? Ask Support! banner at the bottom of this page, or calling us at 1-888-663-5491. 

Comments