Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. How to do logical AND in conditionals?

How to do logical AND in conditionals?

Scheduled Pinned Locked Moved Help and Support
8 Posts 3 Posters 1.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deeeds
    wrote on last edited by
    #1

    If this AND that then jump

    ... how to do this in hyperPad?

    Aidan_FireA 1 Reply Last reply
    0
    • D Deeeds

      If this AND that then jump

      ... how to do this in hyperPad?

      Aidan_FireA Offline
      Aidan_FireA Offline
      Aidan_Fire
      wrote on last edited by
      #2

      @Deeeds Have an If stacked on top of another If. The more conditions you have, the longer your If chain is.

      1 Reply Last reply
      0
      • Aidan_FireA Offline
        Aidan_FireA Offline
        Aidan_Fire
        wrote on last edited by Aidan_Fire
        #3

        0_1509858027335_C46BF54C-8EA6-41BB-97CB-00B8BE87BA9D.png

        D 1 Reply Last reply
        1
        • Aidan_FireA Aidan_Fire

          0_1509858027335_C46BF54C-8EA6-41BB-97CB-00B8BE87BA9D.png

          D Offline
          D Offline
          Deeeds
          wrote on last edited by
          #4

          @Aidan-Oxley What about OR, XOR and NOT?

          Aidan_FireA Jack de WildeJ 2 Replies Last reply
          0
          • D Deeeds

            @Aidan-Oxley What about OR, XOR and NOT?

            Aidan_FireA Offline
            Aidan_FireA Offline
            Aidan_Fire
            wrote on last edited by Aidan_Fire
            #5

            @Deeeds For Or, have the two Ifs next to each other underneath the event. I don’t know what XOR is. For not, press the “is equal to” when you tap the If behaviour, there will be a not equal to (≠).

            1 Reply Last reply
            0
            • Aidan_FireA Offline
              Aidan_FireA Offline
              Aidan_Fire
              wrote on last edited by
              #6

              0_1509860759545_C98238C3-206F-41DF-980D-B976684252F0.png

              1 Reply Last reply
              1
              • D Deeeds

                @Aidan-Oxley What about OR, XOR and NOT?

                Jack de WildeJ Offline
                Jack de WildeJ Offline
                Jack de Wilde
                wrote on last edited by Jack8680
                #7

                @Deeeds

                (I'm going to use this to learn the code formatting on the forums)

                Like Aidan said, (P AND Q) can be represented by nesting ifs. It can be done as

                //# I'm not sure I fully get the syntax for comments
                output = 0 //# default to 0 if they aren't both true
                if P == 1:
                    if Q == 1
                        output = 1 //# set to 1 if they are both true
                return output
                

                P OR Q:

                output = 1 //# defaults to 1
                if P == 0
                    if Q == 0
                        output = 0 //# if NOT(P) AND NOT(Q) is true, return 0
                return output
                

                (P XOR Q) is the equivalent to ((P OR Q) AND NOT(P AND Q)), but there's an easy shortcut in that it's true when P ≠ Q:

                output = 0
                if P != Q:
                    output = 1
                return output
                

                Edit: oh yeah, NOT P:

                output = 1
                if P = 1
                    output = 0
                return output
                

                Edit 2: As hyperPad behaviours:
                0_1509869001029_IMG_0361.PNG

                D 1 Reply Last reply
                2
                • Jack de WildeJ Jack de Wilde

                  @Deeeds

                  (I'm going to use this to learn the code formatting on the forums)

                  Like Aidan said, (P AND Q) can be represented by nesting ifs. It can be done as

                  //# I'm not sure I fully get the syntax for comments
                  output = 0 //# default to 0 if they aren't both true
                  if P == 1:
                      if Q == 1
                          output = 1 //# set to 1 if they are both true
                  return output
                  

                  P OR Q:

                  output = 1 //# defaults to 1
                  if P == 0
                      if Q == 0
                          output = 0 //# if NOT(P) AND NOT(Q) is true, return 0
                  return output
                  

                  (P XOR Q) is the equivalent to ((P OR Q) AND NOT(P AND Q)), but there's an easy shortcut in that it's true when P ≠ Q:

                  output = 0
                  if P != Q:
                      output = 1
                  return output
                  

                  Edit: oh yeah, NOT P:

                  output = 1
                  if P = 1
                      output = 0
                  return output
                  

                  Edit 2: As hyperPad behaviours:
                  0_1509869001029_IMG_0361.PNG

                  D Offline
                  D Offline
                  Deeeds
                  wrote on last edited by
                  #8

                  @Jack8680 INCREDIBLE!!!

                  THANK YOU!!!!!!!

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Search